StyleFormatConditionBase.Condition Property
Gets or sets the comparison operation used by the style condition object.
Namespace: DevExpress.XtraEditors
Assembly: DevExpress.XtraEditors.v24.2.dll
NuGet Package: DevExpress.Win.Navigation
#Declaration
[DefaultValue(FormatConditionEnum.None)]
[XtraSerializableProperty]
public FormatConditionEnum Condition { get; set; }
#Property Value
Type | Default | Description |
---|---|---|
Format |
None | A Format |
Available values:
Name | Description |
---|---|
None | The style is not applied to any cell. |
Equal | The style is applied to cells (or corresponding rows) whose values match the Style |
Not |
The style is applied to cells (or corresponding rows) whose values do not match the Style |
Between | The style is applied to cells (or rows) whose values are between the Value1 and Value2 property values exclusive. Enable the Between |
Not |
The style is applied to cells (or rows) whose values are not between the Value1 and Value2 property values inclusive. Enable the Between |
Less | The style is applied to cells (or corresponding rows) whose values are less than that specified by the Style |
Greater | The style is applied to cells (or corresponding rows) whose values are greater than that specified by the Style |
Greater |
The style is applied to cells (or corresponding rows) whose values are greater or equal to the Style |
Less |
The style is applied to cells (or corresponding rows) whose values are less or equal to the Style |
Expression | The style is applied to cells (or corresponding rows) if the Style |
#Example
The following example shows how to create a condition to style grid rows, and specify criteria for the condition using a string expression.
The condition’s criteria is specified by the StyleFormatConditionBase.Expression property. The expression selects rows that do not contain null in the Region field. Rows that match this condition will be painted in light pink.
The following image shows this condition applied to an XtraGrid control.
using DevExpress.XtraGrid;
StyleFormatCondition condition1 = new DevExpress.XtraGrid.StyleFormatCondition();
condition1.Appearance.BackColor = Color.SeaShell;
condition1.Appearance.Options.UseBackColor = true;
condition1.Condition = FormatConditionEnum.Expression;
condition1.Expression = "[Region] != ?";
gridView1.FormatConditions.Add(condition1);