Hi.
I didn't find a solution for this but I think it should be doable.
I have a number of items in a collection and want to select some of them. Each item has a CanInclude property containing the elements that can be selected if itself is already selected.
- Item1 CanInclude: Item4, Item5
- Item2 CanInclude: Item3, Item4
- Item3 CanInclude: Item2
- Item4 CanInclude: Item1
- Item5 CanInclude: Item2, Item3
A starting element is selected somewhere else.
So if start item is Item1, I want to have a comboBox with Item4 and Item5 in it. If i select Item5 in this comboBox and click on a '+' button I want to get a new Box underneath with Item2, Item3(from last checkbox) and Item4(from start item) and so on till there is no other item that can be selected or the user clicks 'OK'.
I have thought of a simple collection in the viewmodel, where [0] holds the start element, [1] the selected element of 1. comboBox and so on. But i don't know how i should dynamically add the comboBoxes or let a comboBox create the [n] element in the collection of selected items. Also I can't think of a way to include all items of the CanInclude properties of the already selected items in the new checkbox.
I would be very thankfull if anyone had an idea.
EDIT: Just for explenation i want somehting like this (Pseudo code included since you can not do {Binding} + {Binding}, but i think you get the idea):
<ComboBox ItemsSource="{Binding Path=SelectableItems}" SelectedItem="{Binding Path=SelectedItem1}" />
<ComboBox ItemsSource="{Binding Path=SelectedItem1.CanInclude}" SelectedItem="{Binding Path=SelectedItem2}"/>
<ComboBox ItemsSource="{Binding Path=SelectedItem1.CanInclude} + {Binding Path=SelectedItem2.CanInclude} - {Binding Path=SelectedItem1} - {Binding Path=SelectedItem2}" SelectedItem="{Binding Path=SelectedItem3}"/>
But I want it to work for a non fixed number of entries.