Create the UniqueDuplicateRuleFormatCondition 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:UniqueDuplicateRuleFormatCondition Rule="Unique" FieldName="City" PredefinedFormatName="GreenFillWithDarkGreenText" />
</dxg:TableView.FormatConditions>
|
The code sample below illustrates how to define the same conditional format in code-behind:
C# |
var cityFormatCondition = new UniqueDuplicateRuleFormatCondition() {
ValueRule = UniqueDuplicateRuleFormatCondition.Unique,
FieldName = "City",
PredefinedFormatName = "GreenFillWithDarkGreenText"
};
view.FormatConditions.Add(cityFormatCondition);
|
VB |
Dim cityFormatCondition = New UniqueDuplicateRuleFormatCondition() With {
.ValueRule = UniqueDuplicateRuleFormatCondition.Unique,
.FieldName = "City",
.PredefinedFormatName = "GreenFillWithDarkGreenText"
}
view.FormatConditions.Add(cityFormatCondition)
|