I'm on writing a simple application, it has a menu and when user choices each MenuItem
, i want to change my window's content to display the selected content.
i have two option to that.
<Frame></Frame>
to my window and write some pages.UserControls
and put them in a ContentControl
as user fires MenuItem
click event.
so I'm confused to select the right choice for this purpose.
Navigation can be succefully implemented by using Frame/Pages or ContentControl/Views. It is a matter of choice.
However, Frame/Page have some gotchas, e.g. page.DataContext not inherited from parent Frame?
If you don't need isolation specifically, then stick to ContentControl. Navigation in prism framework is built with regions which are located in different type of controls (e.g. ContentControl, TabControl), not Frame (see docs)
one more approach for simple navigation is ViewModel based.
Examples:
Navigation with MVVM by Rachel Lim (external)