I have quite a basic WPF form with a DockPanel, there’s a Menu bar, a Status bar, and a UserControl. Like so:
<DockPanel> <Menu DockPanel.Dock='Top'> ... </Menu> <StatusBar DockPanel.Dock='Bottom'> ... </StatusBar> <UserControls:MyUserControl /> <DockPanel>
My problem is: Based on an event, I want to transition the UserControl to a second user control.
There’s no problem with them both being defined in the XAML (as I know what the other control will be), but I just can’t work out the type of container I need for this that will allow me to use an animation (ideally something like one disappearing to the left and the other appearing from the right). The UserControls should grow automatically to use up all the available space.
Any ideas?
Edit: Here’s what I’m trying to do in a general sense. Maybe someone can suggest a better way.
I have a ListView/GridView that has a list of clients. When the user double clicks on a client I want to replace the list of clients with a UserControl that displays details on that client (and further allows them to interact).
Found out a way of doing it. I put a grid where the UserControl was before and then put both UserControls inside that. Set one to visible and one to collapsed. Then on the event fire I can play my animation which (among other things) swaps the visibility.
So in my window I have
Then in the window resources this
Then in the code when I want to hide control 1 and show control 2, I have this: