Colors in Expression Bindings [v15+]

Starting with v15 you can use a set of color placeholders in Expression Bindings that respect the current theme (light / dark)

When using ExpressionBindings to control the foreground of text based on a condition it's useful to fallback to the Default text color for the current theme. This can now be achieved by using the following placeholder strings in your binding expressions:

  • "SUCCESS_COLOR"

  • "INFORMATION_COLOR"

  • "WARNING_COLOR"

  • "CRITICAL_COLOR"

  • "EXCEPTION_COLOR"

  • "DEFAULT_TEXT_COLOR"

  • "DEFAULT_BACKGROUND_COLOR"

Here's an example of how to use them:

$"iif(double(int(@RowData.Row.{col.BindingPath})) < 0, \"CRITICAL_COLOR\", \"DEFAULT_TEXT_COLOR\")"

Please note that any XAML resource can be accessed using this approach, as long as you use the key that's defined in the system theme.

Last updated