How do I bind a bool to select a specific image? For eg. I have My Image control. I have a binded property with the name of IsTrue.
I have 2 images:
- TrueImg.png
- FalseImg.png
How do I show an image based on bool?
Then how can I extend this to affect strings, such as “Male”, “Female”?
All images are located inside the silverlight app.
Take a look the blog article A Generic Boolean Value Converter. With the code there in place you add this converter:-
Now add an instance of this to your Xaml:-
Now you can bind using this converter:
Similarly you can add a converter for you strings:-
and:-