I've a situation in which there is a common control which is used couple of places in application.
Now in this i've a data trigger on a property say A. i.e.
DataTrigger Binding={Binding A} .......
Now it may be possible that property A doesn't exist in view model, in that case i need to add another trigger based on property B (which exist in that ViewModel).
Something like:
Multidatatrigger
DataTrigger Binding A - doesn't exist
DataTrigger Binding B
Do something.....
Can someone suggest me how i should approach for this. . As if i try to do as such then binding exception will be thrown because A doesn't exist in current View Model. Or any other approach would work here... Thanks
You can make use of PriorityBinding.
<DataTrigger Value="XXX">
<DataTrigger.Binding>
<PriorityBinding>
<Binding Path="A"/>
<Binding Path="B"/>
</PriorityBinding>
</DataTrigger.Binding>
<Setter ...
</DataTrigger>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With