wpf-devexpress-dot-xpf-dot-pivotgrid-4159437b.md
Represents a format condition based on a specified rule(s) or expression.
Namespace : DevExpress.Xpf.PivotGrid
Assembly : DevExpress.Xpf.PivotGrid.v25.2.dll
NuGet Package : DevExpress.Wpf.PivotGrid
public class FormatCondition :
ExpressionConditionBase
Public Class FormatCondition
Inherits ExpressionConditionBase
Use the FormatCondition condition to compare a data cell value with a specific constant(s) or expression.
The FormatCondition class is inherited from the FormatConditionBase base class and represents a format condition based on a specified rule(s) or expression. To apply the condition, create a new FormatCondition instance, specify its parameters and add it to the PivotGridControl.FormatConditions collection.
Specify the value rule using the FormatCondition.ValueRule property. To specify a constant(s), with which a value is compared, use the FormatCondition.Value1 and FormatCondition.Value2 properties.
For each condition, you can select one of the predefined formats using the FormatConditionBase.PredefinedFormatName property or apply a custom format by creating new Format collection and specifying its parameters.
For each condition, you can select one of the predefined formats or apply a custom format.
The following code sample shows how to apply FormatCondition with the predefined format and specified value rule.
using DevExpress.Xpf.PivotGrid;
using DevExpress.Xpf.Core.ConditionalFormatting;
public MainWindow()
{
// ...
// Creates a new FormatCondition instance.
FormatCondition formatRule = new FormatCondition();
// Configures the format condition.
formatRule.ApplyToSpecificLevel = true;
formatRule.ColumnName = "fieldQuarter";
formatRule.RowName = "fieldSalesPerson";
formatRule.MeasureName = "fieldExtendedPrice";
formatRule.ValueRule = ConditionRule.GreaterOrEqual;
formatRule.Value1 = 500;
formatRule.PredefinedFormatName = "GreenFillWithDarkGreenText";
// Adds this instance to the FormatConditionCollection.
pivotGridControl1.AddFormatCondition(formatRule);
}
Imports DevExpress.Xpf.PivotGrid
Imports DevExpress.Xpf.Core.ConditionalFormatting
Public Sub New()
' ...
' Creates a new FormatCondition instance.
Dim formatRule As New FormatCondition()
' Configures the format condition.
formatRule.ApplyToSpecificLevel = True
formatRule.ColumnName = "fieldQuarter"
formatRule.RowName = "fieldSalesPerson"
formatRule.MeasureName = "fieldExtendedPrice"
formatRule.ValueRule = ConditionRule.GreaterOrEqual
formatRule.Value1 = 500
formatRule.PredefinedFormatName = "GreenFillWithDarkGreenText"
' Adds this instance to the FormatConditionCollection.
pivotGridControl1.AddFormatCondition(formatRule)
End Sub
Object DispatcherObject DependencyObject FormatConditionBase ExpressionConditionBase FormatCondition
See Also