TopBottomRuleFormatCondition.Threshold Property
Specifies the number or percentage of cells (or corresponding rows) to format. This is a bindable property.
Namespace: DevExpress.Mobile.DataGrid
Assembly: DevExpress.Mobile.Grid.v18.2.dll
#Declaration
#Property Value
Type | Description |
---|---|
Double | The number of cells to format. |
#Remarks
Important
This documentation topic describes legacy technology. We no longer develop new functionality for the Grid
The Threshold property is in effect for the following rules:
- TopBottomRule.TopItems
- TopBottomRule.TopPercent
- TopBottomRule.BottomItems
- TopBottomRule.BottomPercent
Depending on the rule (TopBottomRuleFormatCondition.Rule), the Threshold property is used to specify either the number or percentage of cells (or corresponding rows) to format.
#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);