WPF/XAML - compare the "SelectedIndex" of two comboboxes (DataTrigger?)

Posted by Luaca on Stack Overflow See other posts from Stack Overflow or by Luaca
Published on 2009-10-01T14:41:41Z Indexed on 2010/03/31 23:03 UTC
Read the original article Hit count: 168

Filed under:
|
|
|

hello,

i've got two comboboxes with the same content. the user should not be allowed to choose the same item twice. therefore the comboboxes' contents (= selectedindex?) should never be equal.

my first attempt was to comapare the selectedindex with a datatrigger to show/hide a button:

<DataTrigger Binding="{Binding ElementName=comboBox1, Path=SelectedIndex}" Value="{Binding ElementName=comboBox2, Path=SelectedIndex}">
     <Setter Property="Visibility" Value="Hidden" />
</DataTrigger>

it seems that it is not possible to use Value={Binding}. is there any other way (if possible without using a converter)? thanks in advance!

© Stack Overflow or respective owner

Related posts about wpf

Related posts about xaml