TopBottomRuleFormatCondition Class
In This Article
Represents a top/bottom format condition.
Namespace: DevExpress.Mobile.DataGrid
Assembly: DevExpress.Mobile.Grid.v18.2.dll
#Declaration
public class TopBottomRuleFormatCondition :
ExpressionConditionBase
#Remarks
Important
This documentation topic describes legacy technology. We no longer develop new functionality for the Grid
#Example
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.
- Create a new
TopBottomRuleFormatCondition
class instance. - 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.
- Set the TopBottomRuleFormatCondition.Rule property to TopBottomRule.TopItems to highlight the highest column values.
- Use the TopBottomRuleFormatCondition.Threshold property to specify the count of column cells with highest values to be highlighted.
- Assign one of the predefined formats to the FormatConditionBase.PredefinedFormatName property. All available format names are listed in the Predefined Format Names document.
- 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);
#Inheritance
Object
FormatConditionBase
ExpressionConditionBase
TopBottomRuleFormatCondition
See Also