In the entry form of my wpf application, I have a list of buttons where the user can select where he wants to do, eg. enter new customer, run report...
What is the best way to show the form (e.g enter new customer) after the user selection? I don't want the form to be a pop up. Also hiding the current work and show the next form will not work, because the wpf application is hosted inside the window32 app.
My guess is to build each of the functionality in user control. on the entry page, load all the user contorls in XAML, but hide them. Show the respectively user control when the user selects it.
Since I am new to WPF, i am not sure if this is the way to do it. it seems like there's overhead on loading all the controls.
Thanks for your help.
Angela
Have a list of all the buttons on the left side of your window
Button 1 ----------------------
Button 2 | User Control |
| Container |
etc. |--------------------|
based on the selection on the left ie Button 1 = new customer, then the user control on the right will load the implementation of user control new customer and place it in the container, similarly when he presses another option he will get a different implementation placed in the container. This way you can dispose his previous work when he is done or has moved to another option.
What your proposing is a fairly common approach, one that I'd probably recommend.
If you really need to start switching between windows then you can do this.
Application.Current.MainWindow = newWindow;
newWindow.Show();
sourceWindow.Close();
Where new window is a references to window you wish to show and sourceWindow is the current Window