✅ WPF - set UIElement (image) in XAML depending on databound Property Enum value
I am trying to dynamically change a StatusBar image via a view's XAML depending upon a databound ViewModel Property. The offender in question:
The enum:
Pseudocode I'm trying to achieve:
Could soemone give me a steer, please?
3 Replies
Just read this example:
Is this the best approach or is a converter better?
EDIT: Ah - you can't use CrispImage in the above, as it can't be added to the Setter Collection. 😦
I'd go for a converter there. A bunch of triggers like that are always a mess, and you can't re-use it
You could use a
CrispImage
there for sure -- any DependencyProperty can be set from a style
(But make sure that the Style TargetType="imaging:CrispImage"
, not "Image"
)Thanks. I did the bleow in the end, but may recosider a converter: