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

Applying conditional formatting based on value of other cells

Hello, sorry if the question may be trivial, but I'm new of WPF and Syncfusion controls.
I've to apply a format to a cell if the value of another cell of the same row satisfies the condition specified.
Example:

var columnFormatting = new GridDataConditionalFormat { [...] };
var columnStyleInfo = new GridDataStyleInfo { [...] };
var conditionFormatting = new GridDataCondition
{
ColumnName = myColumnName,
ConditionType = GridDataConditionType.NotEquals,
Value = [***** Value contained in the cell of the same row and column named "myColumnName2" *****],
PredicateType = PredicateType.Or
};

columnFormatting.Style = columnStyleInfo;
columnFormatting.Conditions.Add(conditionFormatting);
myDataGrid.ConditionalFormats.Add(columnFormatting);

How is it possible to do that?
Thank you for your support. Regards
    Luca Cavicchioli

1 Reply

SM Saravanan M Syncfusion Team February 27, 2014 11:46 AM UTC

Hi Luca,

We are sorry for delay caused,

 We have analyzed your query. We could not add Conditional Format based on next cell value. We can add the conditional format based on the same column value. But we are able to format the cell based on next cell value by using QueryCellInfo event. We have prepared the sample based on this and you can download the sample from attachment.

 Please let us know if you have any queries,

Regards,

Saravanan.M


Attachment: GDC_Sample_FormatCells_bc6b109e.zip

Loader.
Live Chat Icon For mobile
Up arrow icon