Back to Devexpress

StyleFormatConditionBase.Condition Property

windowsforms-devexpress-dot-xtraeditors-dot-styleformatconditionbase-92b2916f.md

latest5.7 KB
Original Source

StyleFormatConditionBase.Condition Property

Gets or sets the comparison operation used by the style condition object.

Namespace : DevExpress.XtraEditors

Assembly : DevExpress.XtraEditors.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
[DefaultValue(FormatConditionEnum.None)]
[XtraSerializableProperty]
public FormatConditionEnum Condition { get; set; }
vb
<DefaultValue(FormatConditionEnum.None)>
<XtraSerializableProperty>
Public Property Condition As FormatConditionEnum

Property Value

TypeDefaultDescription
FormatConditionEnumNone

A FormatConditionEnum enumeration value which specifies the comparison operation.

|

Available values:

NameDescription
None

The style is not applied to any cell.

| | Equal |

The style is applied to cells (or corresponding rows) whose values match the StyleFormatConditionBase.Value1 property value.

| | NotEqual |

The style is applied to cells (or corresponding rows) whose values do not match the StyleFormatConditionBase.Value1 property value.

| | Between |

The style is applied to cells (or rows) whose values are between the Value1 and Value2 property values exclusive. Enable the BetweenConditionsIncludeEndpoints option to make the Between condition inclusive.

| | NotBetween |

The style is applied to cells (or rows) whose values are not between the Value1 and Value2 property values inclusive. Enable the BetweenConditionsIncludeEndpoints option to make the NotBetween condition exclusive.

| | Less |

The style is applied to cells (or corresponding rows) whose values are less than that specified by the StyleFormatConditionBase.Value1 property.

| | Greater |

The style is applied to cells (or corresponding rows) whose values are greater than that specified by the StyleFormatConditionBase.Value1 property.

| | GreaterOrEqual |

The style is applied to cells (or corresponding rows) whose values are greater or equal to the StyleFormatConditionBase.Value1 property value.

| | LessOrEqual |

The style is applied to cells (or corresponding rows) whose values are less or equal to the StyleFormatConditionBase.Value1 property value.

| | Expression |

The style is applied to cells (or corresponding rows) if the StyleFormatConditionBase.Expression evaluates to true.

|

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.

csharp
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);
vb
Imports DevExpress.XtraGrid

Dim condition1 As StyleFormatCondition = 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)

See Also

Expression

IsValid

StyleFormatConditionBase Class

StyleFormatConditionBase Members

DevExpress.XtraEditors Namespace