Skip to main content
All docs
V21.2
  • FormatCondition.Expression Property

    Specifies the expression used to apply a conditional format. This is a dependency property.

    Namespace: DevExpress.UI.Xaml.Grid

    Assembly: DevExpress.UI.Xaml.Grid.v21.2.dll

    NuGet Package: DevExpress.Uwp.Controls

    Declaration

    public string Expression { get; set; }

    Property Value

    Type Description
    String

    A string value that specifies the expression used to apply a conditional format.

    Remarks

    The XAML snippet below illustrates how to change the font color to green for positive values in the Profit column.

    <Grid:GridControl.FormatConditions>
        <Grid:FormatCondition FieldName="Profit" Expression="[Profit] &gt;= 0" PredefinedFormatName="GreenText"/>
    </Grid:GridControl.FormatConditions>
    

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

      var profitFormatCondition = new FormatCondition() {
          FieldName = "Profit",
          Expression = "[Profit] > 0",
          PredefinedFormatName = "GreenText"
      };
      gridControl.FormatConditions.Add(profitFormatCondition);
    

    The image below shows the result.

    Use the ValueRule property to specify a predefined rule for conditional formatting.

    See Also