TopBottomRuleFormatCondition Class

Represents a top/bottom format condition.

Namespace: DevExpress.Mobile.DataGrid

Assembly: DevExpress.Mobile.Grid.v18.2.dll


public class TopBottomRuleFormatCondition :
Public Class TopBottomRuleFormatCondition
    Inherits ExpressionConditionBase



This documentation topic describes legacy technology. We no longer develop new functionality for the GridControl and suggest that you use the new DataGridView control instead.


This example illustrates how to apply a top/bottom format to the Total column in a GridControl. The top/bottom format allows you to find the highest or lowest cell values. In this tutorial, the five top values in the Total column are highlighted.


  1. Create a new TopBottomRuleFormatCondition class instance.
  2. Set this object's FormatConditionBase.FieldName property to Total. This column provides values to test against the formatting rule and the specified format will be applied to this column.
  3. Set the TopBottomRuleFormatCondition.Rule property to TopBottomRule.TopItems to highlight the highest column values.
  4. Use the TopBottomRuleFormatCondition.Threshold property to specify the count of column cells with highest values to be highlighted.
  5. Assign one of the predefined formats to the FormatConditionBase.PredefinedFormatName property. All available format names are listed in the Predefined Format Names document.
  6. To apply a conditional formatting rule represented by the created TopBottomRuleFormatCondition object, add this object to the GridControl.FormatConditions collection.
using DevExpress.Mobile.DataGrid;
using DevExpress.Mobile.Core.ConditionalFormatting;
// ...

TopBottomRuleFormatCondition condition = new TopBottomRuleFormatCondition();
condition.FieldName = "Total";
condition.Rule = TopBottomRule.TopItems;
condition.Threshold = 5;
condition.PredefinedFormatName = "GreenFillWithDarkGreenText";

grid.FormatConditions.Add (condition);


See Also