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

Customer formatting using QueryCellInfo

Thread ID:





105586 Oct 15,2012 04:04 PM UTC Nov 29,2012 07:28 AM UTC WPF 1
Tags: GridControl
John Millage
Asked On October 15, 2012 04:04 PM UTC

I am using the DataGrid and trying to do some custom grid formatting using the QueryCellInfoCommand.  I get the style object out in the callback, but I need the object from the bound item source (because i determine the style from that).  How can i get this object using the cellStyle?  Thanks.

Ravi Shankar B [Syncfusion]
Replied On November 29, 2012 07:28 AM UTC

Hi John,


We have analyzed your query and you can achieve your requirement by get the record through CellIdentity from GridDataStyleInfo as follows.

C# code snippet:

 void Model_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e)


            var style = e.Style as GridDataStyleInfo;

            var cellidentity = style.CellIdentity;

            if (cellidentity != null && cellidentity.Record != null)


                //Here based on the cellidentity.Record, you can apply style


                var Record = cellidentity.Record as DataRowView;

                var item =Record.Row.ItemArray[3];

                if (item.ToString().Contains("Mobile"))

                    e.Style.Background = Brushes.Lavender;




Alternatively, for your requirement we have Conditional Formatting feature, you can format the cell style by cell values as follows.


XAML code snippet:

                <syncfusion:GridDataConditionalFormat Name="Column1" ApplyStyleToColumn="ProductPrice">
                        <syncfusion:GridDataStyleInfo Background="BurlyWood" />
                        <syncfusion:GridDataCondition ColumnName="ProductPrice"
                                                      Value="200" />



We have created simple sample on this and you can download the sample from the following link.




Ravi Shankar B.


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