I’m using Caliburn Micro MVVM. I want to make category selection usercontrol consisting of few dynamic comboboxes (or listboxes) based on generic tree collection. User must choose any leaf node from category tree, so new collections will keep appearing as long as selected node has children beneath it. Depth may vary.
I want it to look like this: https://i.stack.imgur.com/gOBx0.png
…and so far it looks like this:
CategorySelectorModel.cs:
public BindableCollection<BindableCollection<Category>> Comboboxes { get; set; }
CategorySelector.xaml:
<ItemsControl x:Name="Comboboxes">
<ItemsControl.ItemTemplate>
<DataTemplate>
<ComboBox ItemsSource="{Binding}" DisplayMemberPath="Name"/>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
So there’s my question: Would it be possible to specify an event for each created combobox and access its SelectedItem property?
It was easier than I expected. My question was pretty unfortunate from this point. I started with this:
Every node of my category tree has a Depth property. Since depth of last selected element is related to number of collections, I just used this property to remove all unnecessary collections when any selected item has changed.