Tab

GridFormatConditionHighlight.Rule Property

Specifies the format condition rule.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v21.1.dll

Declaration

[DefaultValue(GridConditionRule.Expression)]
public GridConditionRule Rule { get; set; }

Property Value

Type Default Description
GridConditionRule

Expression

One of the GridConditionRule enumeration values.

Available values:

Name Description
None

Cell highlighting is disabled.

Equal

Highlight cells whose values are equal to the value specified by the GridFormatConditionHighlight.Value1 property.

NotEqual

Highlight cells whose values are not equal to the value specified by the GridFormatConditionHighlight.Value1 property.

Between

Highlight cells whose values are between values specified by the GridFormatConditionHighlight.Value1 and GridFormatConditionHighlight.Value2 properties.

NotBetween

Highlight cells whose values are not between values specified by the GridFormatConditionHighlight.Value1 and GridFormatConditionHighlight.Value2 properties.

Less

Highlight cells whose values are less than the value specified by the GridFormatConditionHighlight.Value1 property.

Greater

Highlight cells whose values are greater than the value specified by the GridFormatConditionHighlight.Value1 property.

GreaterOrEqual

Highlight cells whose values are greater than or equal to the value specified by the GridFormatConditionHighlight.Value1 property.

LessOrEqual

Highlight cells whose values are less than or equal to the value specified by the GridFormatConditionHighlight.Value1 property.

Expression

Highlight cells whose values fit the expression specified by the GridFormatConditionHighlight.Expression property.

Remarks

Use the Rule property to specify the format condition rule applied to cells of data fields specified by the GridFormatConditionBase.FieldName property.

When the Rule property is set to Expression, use the GridFormatConditionHighlight.Expression property to specify a custom rule expression.

When a cell value meets the condition specified by the Rule property, the cell is highlighted using the format specified by the GridFormatConditionExpressionBase.Format property.

NOTE

The Rule property value cannot be specified in markup.

Example

...
{
    CardViewFormatConditionColorScale Format1 = new CardViewFormatConditionColorScale();
    Format1.FieldName = "Discount";
    Format1.Format = GridConditionColorScaleFormat.GreenYellow;
    Format1.MinimumValue = 0.15;
    Format1.MaximumValue = 0.25;

    CardViewFormatConditionHighlight Format2 = new CardViewFormatConditionHighlight();
    Format2.Format = GridConditionHighlightFormat.Custom; 
    Format2.CardStyle.BackColor = Color.Orange;
    Format2.ApplyToCard = true;
    Format2.Rule = GridConditionRule.Expression;
    Format2.Expression = "[Quantity] < 50";
    Format2.FieldName = "Quantity";

    CardViewFormatConditionTopBottom Format3 = new CardViewFormatConditionTopBottom();
    Format3.FieldName = "UnitPrice";
    Format3.Format = GridConditionHighlightFormat.BoldText;
    Format3.Rule = GridTopBottomRule.TopItems;
    Format3.Threshold = 10;

    ASPxCardView1.FormatConditions.Add(Format1);
    ASPxCardView1.FormatConditions.Add(Format2);
    ASPxCardView1.FormatConditions.Add(Format3);
}
See Also