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 change style of a cell using GridDataControl

How do I change a cell style, not a column or a row, a specific cell?
I'm using binding to attach data to a griddatacontrol, and I want to change some cells background.
I've searched the griddatacontrol API, and didn't find a way to do this.

3 Replies

SM Saravanan M Syncfusion Team June 29, 2015 01:00 PM UTC

Hi Vincent,
Thank you for contacting Syncfusion support,
We have analyzed your query and you can change the background for cell using QueryCellInfo event. Please refer the below code snippet.
Code snippet[C#]:
 void Model_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e)
            if(e.Style.RowIndex == 3 && e.Style.ColumnIndex == 4)
                e.Style.Background = Brushes.SandyBrown;
                e.Style.Font.FontStyle = FontStyles.Italic;
We have prepared the sample based on this and you can download it from following location,
Sample Location: GridDataControl_Sample
Also we have a SfDataGrid control like GridDataControl. But when compared to GridDataControl, SfDataGrid has a better performance and flexibility. SfDataGrid assists you to create entirely customizable and highly interactive features used to display and manipulate the huge amount of data. So, we suggest you to use SfDataGrid instead of GridDataControl
You can also achieve the same requirement in SfDataGrid. Please refer the below KB link to change background color for Cell also refer the sample from the KB.
You can also refer the below documentation link to know more about styles in SfDataGrid,
Please let us know if you have any other queries,

MA maha February 17, 2016 06:59 AM UTC

Is it possible to change cell background in object_CurrentCellChanged attached behaviour ?

SP Sowndaiyan Paulpandi Syncfusion Team February 18, 2016 12:44 PM UTC

Hi Maha,

In GridDataControl you can able to change cell background color in
CurrentCellChanged event like the below code example.


   void syncgrid_CurrentCellChanged(object sender, Syncfusion.Windows.ComponentModel.SyncfusionRoutedEventArgs args)

            //Here 2 is RowIndex and 1 is ColumnIndex

            this.syncgrid.Model[2, 1].Background = Brushes.Red;




Live Chat Icon For mobile
Up arrow icon