I've written a MultiValueConverter which checks if a given list contains a given value and returns true if it does. I use it for binding to custom checkbox list. Now I'd like to write ConvertBack method so that if checkbox was checked, original value would be sent to the model. Is there a way to access values in ConvertBack method?
XAML:
<ListBox.ItemTemplate>
<HierarchicalDataTemplate>
<CheckBox Content="{Binding Path=Description}">
<CheckBox.IsChecked>
<MultiBinding Converter="{x:Static Classes:ListContainsMultiConverter.Instance}">
<Binding Path="Id" />
<Binding Path="DataContext.ContactTypes" RelativeSource="{RelativeSource AncestorType={x:Type Window}}" />
</MultiBinding>
</CheckBox.IsChecked>
</CheckBox>
</HierarchicalDataTemplate>
</ListBox.ItemTemplate>
I get correct results when I'm binding but is there a way to get the bound id when converting back? What I would like to achieve is that if checkbox is unchecked, the value would be removed from the list and if it is checked, the value would be added to the list.