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

Change visual style in a GridControl in virtual mode


GridControl :

How to apply a visual style (theme) in virtual mode ?

Do I have to change style for each cell in Model_QueryCellInfo ?

All examples use the "", but there is no such control in my application :)

br


1 Reply

CB Clay Burch Syncfusion Team October 2, 2009 10:47 AM UTC

There is no direct property setting to apply a visualstyle to a GridControl (such settings are only available on GridDataControl and GridTreeControl).

But you can use code such as this to apply such settings to a GridControl.

private void SetVisualStyle(VisualStyle vs, GridControl grid)
{
IGridDataVisualStyle visualStyle = null;
switch (vs.ToString())
{
case "Office2007Blue":
visualStyle = new GridDataBlueVisualStyle();
break;
case "Office2007Black":
visualStyle = new GridDataBlackVisualStyle();
break;
case "Office2007Silver":
visualStyle = new GridDataSilverVisualStyle();
break;
case "Blend":
visualStyle = new GridDataBlendVisualStyle();
break;
case "Office2003":
visualStyle = new GridDataSyncBlueVisualStyle();
break;
default:
visualStyle = new GridDataDefaultGridVisualStyle();
break;
}

grid.Model.HeaderStyle.Background = visualStyle.HeaderBackgroundBrush;
grid.Model.HeaderStyle.Foreground = visualStyle.HeaderForegroundBrush;
grid.InvalidateCells();
}

Loader.
Live Chat Icon For mobile
Up arrow icon