Skip to main content
A newer version of this page is available. .

Creating Conditional Formatting Rules

Conditional formatting rules can be created at design time and runtime.

Use the ASPxCardView.FormatConditions property, which provides access to a collection of rules represented by the GridFormatConditionBase class descendants: CardViewFormatConditionColorScale, CardViewFormatConditionHighlight, CardViewFormatConditionIconSet and CardViewFormatConditionTopBottom objects, to add conditions.

The Rule property allows you to specify the style format rule, which defines the condition and appearance settings applied when the specified condition is true. The Format property defines the formatting settings applied to cells whose values take part in conditional formatting.

Refer to the Conditional Formatting Types topic for more information.


...
<FormatConditions>
    <dx:CardViewFormatConditionTopBottom Rule="BottomItems" Threshold="10" FieldName="Price" Format="BoldText" />
    <dx:CardViewFormatConditionTopBottom Rule="BottomItems" Threshold="10" FieldName="Price" Format="GreenText" />
    <dx:CardViewFormatConditionTopBottom Rule="TopItems" Threshold="10" FieldName="Price" Format="BoldText" />
    <dx:CardViewFormatConditionTopBottom Rule="TopItems" Threshold="10" FieldName="Price" Format="RedText" />
    <dx:CardViewFormatConditionIconSet FieldName="Baths" Format="Arrows3Colored" />
    <dx:CardViewFormatConditionIconSet FieldName="Beds" Format="Arrows3Colored" />
    <dx:CardViewFormatConditionTopBottom FieldName="HouseSize" Rule="TopItems" Threshold="5" Format="GreenText" />
    <dx:CardViewFormatConditionTopBottom FieldName="HouseSize" Rule="BottomItems" Threshold="5" Format="RedText" />
</FormatConditions>
...