I have a UI issue with layered editing where a different set of tools needs to be visible depending on the Combobox selecting the layer and am stewing over the idiom to use. The tools should not be in a visible container.
The Combobox selection is bound to a simple integer property in the ViewModel.
The alternatives I've been considering are mostly based around a series of StackPanel containers at the same location:
- Bind the StackPanels' visibility properties to a different ViewModel property for each, then have those visibility properties calculate based on the Combo's backing value. I will have to add some further notification to ensure they refresh when the Combo changes.
- Use a ValueConverter to bind StackPanels' visibility properties directly to the Combo selection
- Put the StackPanels in each of the TabItems in a TabControl and suppress any drawing of header, so the TabControl selection can be mapped directly to the Combo selection.
- Use a Selector subclass or just templating a Selector to get the behaviour of 3 without any baggage from TabControl.
- The approach I'm using for now - added a Click handler to the popup on which their visibility is supposed to depend and simply set the visibility of the different panels according to that popup's SelectedIndex. Very old-school but simple and easy to follow code.