Supporting navigation
When you start to build a real application, navigation is one of the first key topics you must address. Other than a very few specific scenarios, in most cases, the application you're going to build will have multiple screens. In WinUI, there are different containers for your layouts:
- Window: This is the main host of your application. Theoretically, a
Window
control can directly contain content, but it has a few limitations. It doesn't expose aDataContext
, it doesn't expose life cycle events (such asLoaded
), and it doesn't support navigation. As such, in real-world applications, theWindow
object acts just as the main container of your application. - Page: The
Page
object is the most used container for the content of your application, since it supports features such asDataContext
and life cycle events. A real-world application typically has multiple pages, and the user can navigate from one to another by using the navigation menu...