The following conditional formats allow you to format cells comparing cell values with static values:
Create the FormatCondition class instance and specify the following settings to create a conditional format in code:
The following code sample illustrates how to define a conditional format in markup:
Xaml |
<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:
C# |
var profitFormatCondition = new FormatCondition() {
ValueRule = ConditionRule.Greater,
Value1 = 10000000,
FieldName = "Profit",
PredefinedFormatName = "LightRedFillWithDarkRedText"
};
view.FormatConditions.Add(profitFormatCondition);
|
VB |
Dim profitFormatCondition = New FormatCondition() With {
.ValueRule = ConditionRule.Greater,
.Value1 = 10000000,
.FieldName = "Profit",
.PredefinedFormatName = "LightRedFillWithDarkRedText"
}
view.FormatConditions.Add(profitFormatCondition)
|