Use Map Converter to Change Color Dynamically
  • 29 Jan 2024
  • PDF

Use Map Converter to Change Color Dynamically

  • PDF

Article summary

Purpose: Practice using a map converter to have the background of a text block change colors based on value ranges.

Task: Configure the background property of a PVTextBlock bound to a tag to turn red when the value is below 30, yellow when between 30 and 45, and green when above 45.

Steps:

  1. Select the PVTextBlock created in the Bind Two Properties to Default Source tutorial. On the Animation panel, make sure the Background property is selected and bound to the default source.

  2. In the first row of the map converter, enter 30 in the Max field.

  3. Click the Edit button in the Result field to open the color editor.

  4. On the Custom tab, type RED in the text field. Click OK.

  5. In the second row, enter 30 in the Min field, 45 in the Max field, and choose yellow for the result.

  6. In the third row, enter 45 in the Min field, then choose green (hint: type “lime”) for the result.

  7. Click Run to test.


Was this article helpful?