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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Problem with covered cells and gradient backgrounds !

Thread ID:





89471 Aug 25,2009 01:19 PM UTC Sep 7,2009 06:51 AM UTC WPF 7
Tags: GridControl
Asked On August 25, 2009 01:19 PM UTC


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));


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


Covered cells problem_439755f7.JPG

Clay Burch [Syncfusion]
Replied On 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.


Replied On August 31, 2009 10:16 AM UTC


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



Clay Burch [Syncfusion]
Replied On 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);

Replied On September 2, 2009 10:10 AM UTC

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.


Clay Burch [Syncfusion]
Replied On 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.


Andre Slenko
Replied On September 3, 2009 08:27 PM UTC

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

Mohamed Suhaib Fahad A. [Syncfusion]
Replied On September 7, 2009 06:51 AM UTC

Hi Andre,

Thanks for your feedbacks.

Grid.WPF Team
Syncfusion Inc.,


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon