Sorry for the weird title.
Let's say I have a combobox with 3 values, A,B,C.
If 'A' is selected, I want to display a certain set of controls. If 'B' is selected, I want to show a different set of controls, but over the exact same spot in the ticket.
Basically like a tab control, but I don't want the tabs visible - but I need certain 'pages', and depending on a bound value, to display one of those pages.
I know that I can create separate userControls and set the visibility of each based on the value of the combobox, but then in my wpf designer, I am stuck seeing all of the possible 'pages' at the same time.
Is this possible to do in WPF? Thanks.
I encountered a very similar situation recently. My solution was to use a Frame control. The Frame control would allow various Pages to be loaded within. Each Page may contain a different set of controls, just like the main window can. If navigation is disabled on the Frame, it should be pretty close to what you are looking for. Sample Xaml:
<Frame Name="thisFrame" Width="250" Height="400"
NavigationUIVisibility="Hidden" />
Within your event handler for changing the combo box:
thisFrame.NavigationService.Navigate(new PageClassName() );
This will make the Frame display the selected Page. Optionally you can provide parameters here to set default states for the UI controls within your new page. If you pass an object this way, you can bind the UI controls to the object to save your changes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With