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

How to change style of a cell using GridDataControl

Thread ID:





119472 Jun 26,2015 07:40 AM UTC Feb 18,2016 12:44 PM UTC WPF 3
Tags: GridDataControl
Asked On June 26, 2015 07:40 AM UTC

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.

Saravanan M [Syncfusion]
Replied On 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,

Replied On February 17, 2016 06:59 AM UTC

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

Sowndaiyan Paulpandi [Syncfusion]
Replied On 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;





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

or the page will be automatically redirected to 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