In my application I have a window with several buttons on the top. By a click on one button a usercontrol is displayed in a contentcontrol under the buttons.
All buttons are bound to one Command in the ViewModel. The decission which usercontrol should be displayed is done by the commandparameter with an enum like:
<Button Content="Pupils" Margin="3" Height="30" Command="{Binding OpenSectionCommand}" CommandParameter="{x:Static local:SectionType.Section1}"/>
My question now is: Where shall I create the new Usercontrol and assign it to the ContentControl?
I had several ideas:
- Bind the Content direct to the ViewModel and assign the new UserControl there
- Bind the Enum and use a converter to create the control