The way to binding image and data

Hello,   Recently I've started using Mendix.   I want to know whether Mendix can bind the image and data value.   ex. When data A equal 1 => Let the image B's color be "Red". When data A equal 2 => Let the image B's color be "Yellow".   Thanks,
2 answers

The easy way to do this would be with conditional visibility:


  • Put two images on your page, one in red and one in yellow
  • Click one of the images and in the properties pane, set the visibility to either "based on attribute value" or "based on expression" depending on your need
  • Fill out the correct attribute or expression for your conditional data
  • Save
  • Repeat for the other image


Alternatively, depending on whether or not your image is an SVG, you can use conditional styling to achieve the same effect.



Other option could also be if the values are enumerable (fixed set of values) to define an enum where you have the possibility to specify a image for each value.