Back to Devexpress

ColorScaleFormat Class

wpf-devexpress-dot-xpf-dot-core-dot-conditionalformatting-05ccea86.md

latest3.7 KB
Original Source

ColorScaleFormat Class

Contains formatting settings for a Color Scales conditional format.

Namespace : DevExpress.Xpf.Core.ConditionalFormatting

Assembly : DevExpress.Xpf.Core.v25.2.dll

NuGet Package : DevExpress.Wpf.Core

Declaration

csharp
public class ColorScaleFormat :
    IndicatorFormatBase
vb
Public Class ColorScaleFormat
    Inherits IndicatorFormatBase

The following members return ColorScaleFormat objects:

Remarks

The ColorScaleFormat class instances are used to set the GridControl’s ColorScaleFormatCondition.Format and PivotGridControl’s ColorScaleFormatCondition.Format properties.

The following image shows the color scale formatting.

The code sample below illustrates how to create the color scale conditional formatting rule with a custom format in markup for GridControl.

xaml
<dxg:TableView.FormatConditions>
   <dxg:ColorScaleFormatCondition FieldName="Sales">
      <dx:ColorScaleFormat ColorMin="White" ColorMiddle="Green" ColorMax="Red"/>
   </dxg:ColorScaleFormatCondition>
</dxg:TableView.FormatConditions>

The code sample below illustrates how to define the same conditional formatting rule in code-behind for GridControl.

csharp
var salesFormatCondition = new ColorScaleFormatCondition() {
   FieldName = "Sales",
   Format = new ColorScaleFormat() {
      ColorMin = Colors.White,
      ColorMiddle = Colors.Green,
      ColorMax = Colors.Red
   }
};
view.FormatConditions.Add(salesFormatCondition);
vb
Dim salesFormatCondition = New ColorScaleFormatCondition() With {
   .FieldName = "Sales",
   .Format = new ColorScaleFormat() With {
      .ColorMin = Colors.White,
      .ColorMiddle = Colors.Green,
      .ColorMax = Colors.Red
   }
}
view.FormatConditions.Add(salesFormatCondition)

Inheritance

Object DispatcherObject DependencyObject Freezable DevExpress.Xpf.Core.ConditionalFormatting.IndicatorFormatBase ColorScaleFormat ColorScaleFormat

See Also

ColorScaleFormat Members

Conditional Formatting

Formatting Values Using Color Scales

Conditional Formatting

DevExpress.Xpf.Core.ConditionalFormatting Namespace