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

GridFormatConditionTopBottom.Rule Property

Specifies the format condition rule.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v19.2.dll

Declaration

[DefaultValue(GridTopBottomRule.AboveAverage)]
public GridTopBottomRule Rule { get; set; }

Property Value

Type Default Description
GridTopBottomRule **AboveAverage**

One of the GridTopBottomRule enumeration values.

Available values:

Name Description
TopItems

Top items (according to acceding sort order) are highlighted. The number of items is specified by the GridFormatConditionTopBottom.Threshold property.

TopPercent

Top items (according to acceding sort order) are highlighted. The percent of highlighted items is specified by the GridFormatConditionTopBottom.Threshold property.

BottomItems

Bottom items (according to acceding sort order) are highlighted. The number of items is specified by the GridFormatConditionTopBottom.Threshold property.

BottomPercent

Bottom items (according to acceding sort order) are highlighted. The percent of highlighted items is specified by the GridFormatConditionTopBottom.Threshold property.

AboveAverage

Items whose cell values are above the average value, are highlighted.

BelowAverage

Items whose cell values are below the average value are highlighted.

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 BottomItems, BottomPercent, TopItems, or TopPercent values, use the GridFormatConditionTopBottom.Threshold property to specify additional condition information, i.e., the number of items or the percent. The AboveAverage and BelowAverage values do not require additional parameters.

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.

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