I am currently stuck in a dead end with the following situation:
I have a collection List<Category>with each Categorycontaining properties Id, Nameand List<string[]>called Subcategory(where the array contains Nameand Idthis subcategory - I did not want to create another class).
I have TreeViewwith HierarchicalDataTemplatecorrectly attached to categories and subcategories. I also have checkboxes next to the node tree, and I bind IsCheckedto MultiBindingthe sub / category identifier and a general list of subcategories / categories that should be filtered.
<CheckBox.IsChecked>
<MultiBinding Converter="{StaticResource IsCategoryChecked}">
<Binding Path="Id"/>
<Binding Path="myDataSet.Tables[Categories]/cat_subcat"/>
</MultiBinding>
</CheckBox.IsChecked>
The converter I'm using just checks if the subfolder / category name is part of the list (both are required). This works great, and overall I'm quite happy with the result.
The problem is converting check / unchecking. When the user changes the value IsChecked, I must either add the category identifier sub / category to the list of all marked categories, or remove this identifier from it. Unfortunately, when I tried to implement the method ConvertBack()for IMultiValueConverter, I only have the ACTUAL value available, which has changed (true or false IsChecked value) and does not have access to the Sub-Category Identity, WHAT A SPECIFIC CHECK is required.
SOLUTIONS I CARRY OUT, but failed:
ConvertBack() Checked/Unchecked, , "" , ! ? , "" , !