Current Situation
I have Grid, this Grid has 3 Rows. Each row contains one of my UserControls. Each UserControl is hardcoded to one of the Grid rows:
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<Grid>
<local:myUserControl DependencyProperty1 = "{Binding Property1}" DependencyProperty2 = "{Binding Property2}" />
<Stackpanel><Button/><Combobox/></StackPanel>
</Grid>
<Grid Grid.Row="1">
<local:myUserControl DependencyProperty1 = "{Binding Property1}" DependencyProperty2 = "{Binding Property2}" />
<Stackpanel><Button/><Combobox/></StackPanel>
</Grid>
[...]
</Grid>
My Task
I have more Controls than I can fit into my Window. I'd like to allow the user to swap between all available Controls by selecting the one he likes in the ComboBox
and then pressing the Button
.
I thought about using ItemTemplating to accomplish this. I've found this post about how to handle different kinds of DataTypes, which helps a lot. Yet I feel like a list would be a little redundant here, since there would always only be one Item in it, but I don't know what to use instead.
My Question
Is there a better solution as the use a list with only one item, or is there even a better way to creata 'swappable' controls at all?