Thursday 16 May 2013

FormatConditions - ColourField property

Pre-requisite : Setup a basic Format Condition

Do you need to set the row font colour to be based on value returned from columns or fields? You can do so by making use of the ColourField property in FormatConditions (only available since Stadium 4.1.2280.5070). This property is similar to the ColourField property in TreeView node.

Scenario : Text colour for the 'Description' column is based on values returned from the 'Colour' column

  1. Setup a format condition as follows :
  • Conditions - I am setting up a minimum condition so that it applies to ALL data  in the Grid
  • ColourField - The ColourField dropdown contains a list of Text type columns available in the Grid. Select the column which returns the value for colour. My selected column name is Colour.
Apply the format condition to the 'Description' column.


View the application :

The FormatConditions is applied to the 'Description' column. You can see that the colour of the text is set to value from 'Colour' column in the same row.

Tips and Tricks
  1. If the value for ColourField property is defined, other Font Colour values will be overridden
  2. If the text returned from the field is invalid (not a valid colour), it will default to Black
  3. To apply format to all rows, you can set GreaterThanOrEquals '0' for Integer fields, and GreaterThanOrEquals 'a' for String fields.
  4. This property can be found in both DataGrid and DetailsView controls
  5. Only Text type columns are selectable in the ColourField dropdown list.


  1. […]  Format Conditions on Grid and Details View new property ColourField. It allows you to set the colour based on a value from one of your fields […]

  2. […] New features in FormatCondtions – Global formatting for Font, ColourField property […]