We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Problem with covered cells and gradient backgrounds !

Hi,

When I create some covered cells and I apply a linear gradient brush to fill their background Essential Grid behaves as is these cells were not covered. each cell in the 'cover area' get its background filled separately by the linear gradient (see attachement).

Here is how I create the covered cells (via a context menu) :

GridRangeInfo range = syncfusionGrid.Model.Selections.Ranges.ActiveRange;

syncfusionGrid.CoveredCells.Add(new CoveredCellInfo(range.Top, range.Left, range.Bottom, range.Right));

syncfusionGrid.InvalidateVisual();

Another problem is:
After having creating the covered cells, we can still select 'some portion' of the covered area as if there were cells there. Tough this covered area must behave as a single cell and 'portion selection' musn't be possible.

Thanks in advance

Nazim YENIER



Covered cells problem_439755f7.JPG

7 Replies

CB Clay Burch Syncfusion Team August 25, 2009 08:32 PM UTC

How are you setting the styles on these covered cell? The proper way to set the style on a covered cell is to set it on the top left corner cell.

grid.CoveredCells.Add(new CoveredCellInfo(2, 2, 6, 3, true, true));

grid.Model[2, 2].Background = new LinearGradientBrush(Colors.Red, Colors.Pink, 45);

Here is a little sample.




WpfApplication18_b433b417.zip


NY Nazim YENIER August 31, 2009 10:16 AM UTC

Hi,

In your code, please try :

grid.Model[2, 2].Background = new LinearGradientBrush(Colors.Red, Colors.Pink, 90);

( Instead of
grid.Model[2, 2].Background = new LinearGradientBrush(Colors.Red, Colors.Pink, 45); )

Then you will notice the problem.

The covered area behaves as if there were 5 different lines in it and sets 5 different gradient background for each of them.

Or it must set a single gradient color for a the whole cell (since it covers the others).

Another problem is when you set

Sincerely

Nazim YENIER


CB Clay Burch Syncfusion Team August 31, 2009 11:05 PM UTC

If you move the code down into the PrepareRenderCell event, the gradient will be drawn correctly over the covered cell. Here is the code from the sample.



void grid_PrepareRenderCell(object sender, GridPrepareRenderCellEventArgs e)
{
if (e.Cell.RowIndex == 2 && e.Cell.ColumnIndex == 2)
{
e.Style.Background = new LinearGradientBrush(Colors.Red, Colors.Pink, 90);//45);
}
}


NY Nazim YENIER September 2, 2009 10:10 AM UTC

Hi,
Can you give me more information about the PrepareRenderCell event please ?

In fact I have to assign a gradient background color to a covered cells area during execution time, when user selects this covered cell and clicks on a button. So I can't know exactly how to use this event.

Thanks in advance.

Nazim YENIER


CB Clay Burch Syncfusion Team September 2, 2009 10:17 PM UTC

Here is a sample that assigns gradient covered cells through a context menu. Just select the cells you want to cover, then right click and select either red or blue. The work of covering the cells is done in PrepareRenderCell.




ContextMenu_c9f728f1.zip


AS Andre Slenko September 3, 2009 08:27 PM UTC

Thank you for the quick response, that's exactly what I needed!


MS Mohamed Suhaib Fahad A. Syncfusion Team September 7, 2009 06:51 AM UTC

Hi Andre,

Thanks for your feedbacks.

Thanks,
Fahad
Grid.WPF Team
Syncfusion Inc.,

Loader.
Live Chat Icon For mobile
Up arrow icon