Reputation: 4583
I have this construct in my xaml.
<Type1 visibility={binding bool1, converter=BoolToVisibilityConverter}/>
<Type1 visibility={binding bool2, converter=BoolToVisibilityConverter}/>
<Type1 visibility={binding bool3, converter=BoolToVisibilityConverter}/>
<Type1 visibility={binding bool4, converter=BoolToVisibilityConverter}/>
However, the users want to see the items where the bool values are false, but in a disabled state. Therefore, I want the bool1, bool2 etc to feed datatriggers in a style.
However, the "bool1", "bool2" texts are explicit today per element of Type1 (they are binding to the viewmodel. Type1 also has other bindings to the viewmodel, so I do not wish to make it a listview or anything changing the datacontext per element.
How do I make a style resource whose datatrigger (or any trigger) can access bound values that are defined per element? Do I bind locally per element against some placeholder element attribute and then use element triggers in the style?
Upvotes: 0
Views: 233
Reputation: 185290
If the bools should actually have nothing to do with the Visibility, why don't you bind directly to IsEnabled
? And if you want to bind to values on the object you can use a RelativeSource
binding with Mode=Self
.
Upvotes: 2