FormatConditionBase.Expression Property

Gets or sets the expression used to apply the corresponding conditional formatting rule. This is a dependency property.

Namespace: DevExpress.Xpf.PivotGrid

Assembly: DevExpress.Xpf.PivotGrid.v20.1.dll

Declaration

public string Expression { get; set; }
Public Property Expression As String

Property Value

Type Description
String

A String value that specifies the expression used to apply the conditional formatting rule.

Remarks

Use the Expression property to specify a condition for expression based conditional formats (ExpressionConditionBase class descendants). Refer to the Conditional Formatting topic to learn more about conditions.

The Expressions Overview topic contains a list of operators, functions and constants you can use in the expressions.

The code sample below illustrates how to define a conditional format with an expression in markup.

<dxpg:PivotGridControl.FormatConditions>
    <dxpg:FormatCondition ColumnName="Category" MeasureName="Category" Expression="Contains([Category], 'ai')" PredefinedFormatName="LightRedFillWithDarkRedText"/>
</dxpg:PivotGridControl.FormatConditions>

The code sample below illustrates how to define the same conditional format in code-behind.

var symbolFormatCondition = new FormatCondition() {
    Expression = "Contains([Category], 'ai')",
    RowName = "Category",
    MeasureName = "Category",
    PredefinedFormatName = "LightRedFillWithDarkRedText"
};
pivotGridControl1.FormatConditions.Add(symbolFormatCondition);

For indicator-type conditional formats (IndicatorFormatConditionBase class descendants) you can use the Expression property to specify a complex custom expression that returns a value based on several parameters (e.g., several columns in a row).

See Also