Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

StyleFormatConditionBase.Expression Property

Gets or sets the Boolean expression. When it evaluates to true, the StyleFormatConditionBase.Appearance is applied to data. The Expression property is in effect when the StyleFormatConditionBase.Condition property is set to FormatConditionEnum.Expression.

Namespace: DevExpress.XtraEditors

Assembly: DevExpress.XtraEditors.v24.2.dll

NuGet Package: DevExpress.Win.Navigation

#Declaration

[DefaultValue("")]
[XtraSerializableProperty]
public string Expression { get; set; }

#Property Value

Type Default Description
String String.Empty

A string that specifies the Boolean expression.

#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.

StyleCondition_Expression_ex

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);
See Also