I want to navigate from main window to other user control which is present in the views folder. I am not using mvvm model. Is it possible to navigate
-
What is `min window` and what you meant by navigate to user control? are you looking for loading an user control in the main window? Please be specific while come up with a question – sujith karivelil Jan 18 '18 at 07:25
-
I have a separate user control ('Example.xaml') and i have a button in Mainwindow.xaml. Onclick of a button i want to navigate to 'Example.xaml' – Priya Jan 18 '18 at 07:57
1 Answers
Seems that question you asked is not complete, but I'll try to answer.
So you have window, and some content inside of it, and that's MainWindow i suppose. You want to change content of main window to contain your user control which is also defined in separate file. So, you can't do this in the way you described.
UserControl is only a control that window can contain, so basicaly you need something like placeholder in your window to change content dynamically like web browser navigation, and that's what Frame is.
Frame is control that helps to provide navigation between pages. You can create Frame inside your MainWindow and also create some pages. Then you will be able to implement switching between pages in your frame using Frame.Navigate() method.
Here is similar question described, please take look:
Window vs Page vs UserControl for WPF navigation?
Also there is a good article that may help you:

- 121
- 1
- 7