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:GridDataControl.ConditionalFormats> <syncfusion:GridDataConditionalFormat Name="Column1" ApplyStyleToColumn="ProductPrice"> <syncfusion:GridDataConditionalFormat.Style> <syncfusion:GridDataStyleInfo Background="BurlyWood" /> </syncfusion:GridDataConditionalFormat.Style> <syncfusion:GridDataConditionalFormat.Conditions> <syncfusion:GridDataCondition ColumnName="ProductPrice" ConditionType="GreaterThan" PredicateType="And" Value="200" /> </syncfusion:GridDataConditionalFormat.Conditions> </syncfusion:GridDataConditionalFormat> </syncfusion:GridDataControl.ConditionalFormats>
|
We have created simple sample on this and you can download the sample from the following link.
http://www.syncfusion.com/downloads/Support/DirectTrac/101303/GDC_CustomFromatting-1610974018.zip
Regards,
Ravi Shankar B.