Range Style

Can we apply style to range of cells in the silver light grid control as like the "change info" in the windows grids?

Thanks and Regards,
Faizal Ahmed.H


1 Reply

PA Ponraja A Syncfusion Team November 2, 2010 01:54 PM UTC

Hi Faizal,

Thank you for using Syncfusion products.
Yes, we can apply the styles to range of cells in a GridControl. Use the following code.

[C#]

//define a style and set some of its properties
GridStyleInfo style = new GridStyleInfo();
style.Background = Brushes.Red;
style.Foreground = Brushes.Blue;

//have some range...
GridRangeInfo range = GridRangeInfo.Cells(3, 3, 7, 6);

//loop through the range and apply the new style to the existing styles
int rowIndex = 0, colIndex = 0;
if(range.GetFirstCell(out rowIndex, out colIndex))
{
grid.Model[rowIndex, colIndex].ModifyStyle(style, Syncfusion.Windows.Styles.StyleModifyType.Override);
while (range.GetNextCell(ref rowIndex, ref colIndex))
{
grid.Model[rowIndex, colIndex].ModifyStyle(style, Syncfusion.Windows.Styles.StyleModifyType.Override);
}
}

Please let us know if you have any query.

Regards,
ponraja




GridSilverlight_197e500.zip

Loader.
Up arrow icon