FormatCondition.Expression Property
In This Article
Specifies the expression used to apply a conditional format. This is a dependency property.
Namespace: DevExpress.WinUI.Grid
Assembly: DevExpress.WinUI.Grid.v23.2.dll
NuGet Package: DevExpress.WinUI
#Declaration
#Property Value
Type | Description |
---|---|
String | A string value that specifies the expression used to apply a conditional format. |
#Remarks
The XAML snippet below illustrates how to change the font color to green for positive values in the Profit column.
<dxg:GridControl.FormatConditions>
<dxg:FormatCondition FieldName="Profit" Expression="[Profit] > 0" PredefinedFormatName="GreenText"/>
</dxg:GridControl.FormatConditions>
The code sample below illustrates how to define the same conditional format in code-behind.
var profitFormatCondition = new FormatCondition() {
FieldName = "Profit",
Expression = "[Profit] > 0",
PredefinedFormatName = "GreenText"
};
gridControl.FormatConditions.Add(profitFormatCondition);
The image below shows the result.
Use the ValueRule property to specify a predefined rule for conditional formatting.
See Also