Wpf navigate the form?

In the input form of my wpf app, I have a list of buttons where the user can select where he wants, eg. enter new customer, run report ...

What is the best way to show the form (for example, enter a new customer) after a user has selected? I don't want the form to pop up. Also, hiding the current job and showing the next form won't work because the wpf application is hosted inside the window32 application.

My guess is to create each of the custom control functions. on the login page, load all custom contorls in XAML but hide them. Show a custom control when the user selects it.

Since I'm new to WPF, I'm not sure if this is the way to do it. seems like the overhead of loading all the controls.

Thanks for your help.

Angela

0


a source to share


2 answers


You have a list of all buttons on the left side of the window

Button 1 ----------------------
Button 2 |     User Control   |
         |     Container      |
etc.     |--------------------|

      



based on the selection on the left, i.e. button 1 = new client then the custom control on the right will load the custom control implementation with the new client and put it in the container, similarly when he clicks another option it will get another implementation put in the container. This way you can get rid of your previous work when it's done or moved on to another option.

+2


a source


What you suggest is a fairly common approach that I would recommend.

If you really need to start switching between windows, you can do this.



Application.Current.MainWindow = newWindow;
        newWindow.Show();
        sourceWindow.Close();

      

If the new window is a link to the window you want to show and sourceWindow is the current window

+1


a source







All Articles