wpf-devexpress-dot-xpf-dot-pivotgrid-dot-formatconditionbase-81fd6e23.md
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.v25.2.dll
NuGet Package : DevExpress.Wpf.PivotGrid
public string Expression { get; set; }
Public Property Expression As String
| Type | Description |
|---|---|
| String |
A String value that specifies the expression used to apply the conditional formatting rule.
|
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);
Dim symbolFormatCondition = New FormatCondition() With {
.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