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

How to set the backgound color of column headers and selected rows

I'm using the GridDataControl. I can not find the way to set the background color mentioned above from the help document.

1 Reply

GK Ganesan K Syncfusion Team November 4, 2009 12:45 PM UTC

Hi Hyla,

Thanks for using Syncfusion products.

We have an interface that lets you define the themed visual style for the GridDataControl. This would be exposed as a CustomVisualStyle property
You can create the custom theme by simply creating a class which implements the IGridDataVisualStyle

You can use the below properties for set HighlightSelectionBackground,HeaderBackground in IGridDataVisualStyle.

public Brush HighlightSelectionBackground
{
get
{
return Brushes.Aqua;
}
}

public Brush HeaderBackgroundBrush
{
get
{
return Brushes.Gray;
}
}

Then set the Created custom class to the GridDataControl using the property CustomVisualStyle as assigned in the below snippet.
this.dataGrid.CustomVisualStyle = new GridDataGlassyGreenStyle();

Finally set the VisualStyle as Custom,
this.dataGrid.VisualStyle = VisualStyle.Custom;

We have a sample for this feature in our Dashboard in the below location.

\WPF\Grid.WPF\Samples\3.5\WindowsSamples\Grid Data Control - Advanced\Custom Visual Style Demo

Please let us know if you need any more details.

Thanks
Ganesan

Loader.
Live Chat Icon For mobile
Up arrow icon