Skip to main content

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

[XtraSerializableProperty]
public double Threshold { get; set; }

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 GridControl and suggest that you use the new DataGridView control instead.

The Threshold property is in effect for the following rules:

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.

ConditionalFormatting_TopBottom

  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