FormatCondition Class

A value based conditional format.

Namespace: DevExpress.Xpf.Grid

Assembly: DevExpress.Xpf.Grid.v20.1.Core.dll

Declaration

public class FormatCondition :
    ExpressionConditionBase
Public Class FormatCondition
    Inherits ExpressionConditionBase

Remarks

This conditional format allows you to format cells comparing cell values with static values.

The image below shows a grid column whose Profit cells are red if their values are greater than 10M.

CFValue

To create this conditional format in code, create the FormatCondition class instance and specify the following settings:

The following code sample illustrates how to define a conditional format in markup:

<dxg:TableView.FormatConditions>
   <dxg:FormatCondition ValueRule="Greater" Value1="10000000" FieldName="Profit" PredefinedFormatName="LightRedFillWithDarkRedText" />   
</dxg:TableView.FormatConditions>

The code sample below illustrates how to define the same conditional format in code-behind:

var profitFormatCondition = new FormatCondition() {
   ValueRule = ConditionRule.Greater,
   Value1 = 10000000,
   FieldName = "Profit",
   PredefinedFormatName = "LightRedFillWithDarkRedText"
};
view.FormatConditions.Add(profitFormatCondition);
See Also