I am trying to understand if it’s possible to change the property the control is binding using triggers…
So i have two Properties for example in ViewModel and using a trigger depending if the first property is null, the control will binding the first property if isn’t null, or binding the second one.
This is possible to achieve? Will work with Commands too?
Thanks in advance!
I typically would not recommend trying this. A different, IMO cleaner, approach is to use the trigger to change the visibility of the object in question.
This allows you to collapse the control and make a different one, with the appropriate binding setup, visible based on a pair of triggers. The advantage here is that you’re not having to refresh the bindings continually, plus, your interface has a 1-1 correlation with the properties in your ViewModel.
This will also work with Commands, as your commanding object (ie: Button) can just be switched out to the newly appropriate one.