Reputation: 1207
I'v got two drop down lists. When selectedIndex for both of these is not -1 it should enable a button. How element property binding can be used here ?
Upvotes: 0
Views: 352
Reputation: 2789
MultiBindings and MultiValueConverters work well, but my first advice to you would be to use M-V-VM. If you are using M-V-VM then you would simply tie the button enabling to a RelayCommand or to a property on your ViewModel such as IsActionAvaialable
. I find that using M-V-VM results in me needing much fewer ValueConverters (just my 2 cents).
Upvotes: 2
Reputation: 20140
You need to use a MultiBinding to bind the IsEnabled property of the Button to multiple SelectedIndex properties, and then you need an IMultiValueConverter to convert the numbers to a Boolean. Here is a great example: http://www.developingfor.net/wpf/multibinding-in-wpf.html
Upvotes: 2