FormatCondition Class

Represents a format condition based on a specified rule(s) or expression (equal, less, between, etc.).

Namespace: DevExpress.Mobile.DataGrid

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


public class FormatCondition :
Public Class FormatCondition
    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 conditional formatting to a Market Share column in a GridControl to highlight cells that match a specific condition. Cells containing values that are less than 20% will be highlighted.


  1. Create a new FormatCondition class instance.
  2. Set this object's FormatConditionBase.FieldName property to MarketShare. This column provides values to test against the formatting rule and the specified format will be applied to this column.
  3. Assign one of the predefined formats to the FormatConditionBase.PredefinedFormatName property. All available format names are listed in the Predefined Format Names document.
  4. Specify the comparison operator by setting the FormatCondition.ValueRule property. In this example, the Less operator is used for constructing the rule's criteria.
  5. Set the FormatCondition.Value1 property to 0.20. This means that the format should be applied to cells with market share less than 20%.
  6. To apply a conditional formatting rule represented by the created FormatCondition object, add this object to the GridControl.FormatConditions collection.
using DevExpress.Mobile.DataGrid;
using DevExpress.Mobile.Core.ConditionalFormatting;
// ...

FormatCondition condition = new FormatCondition ();
condition.FieldName = "MarketShare";
condition.PredefinedFormatName = "RedText";
condition.ValueRule = ConditionRule.Less;
condition.Value1 = 0.20;

grid.FormatConditions.Add (condition);
See Also