I am trying to create a style for comboxitem. I want to pass the current comboboxitem to converter. Style is like
<Style x:Key="MyVisibilityStyle" TargetType="{x:Type ComboBoxItem}">
<Setter Property="Visibility">
<Setter.Value>
<MultiBinding Converter="{StaticResource VisibiltyMultiValueConverter}">
<Binding Path="."/>
<Binding Path="SelectedItem"
ElementName="ABCComboBox"/>
</MultiBinding>
</Setter.Value>
</Setter>
</Style>
Problem is the “.” is passing the object of MainWindow not the comboboxitem.
Through
<Binding Path=".">youre passing the object which the ComboBoxItem holds, but with<Binding RelativeSource="{RelativeSource Self}"/>you can pass the control itself.What you also could do is passing the whole ComboBox and its selected index/item:
and in your converter you could get your ComboBoxItem like so:
or