When should I use a UserControl instead of a Page?

前端 未结 4 1625
长发绾君心
长发绾君心 2021-01-12 03:27

I notice that many of the WPF MVVM frameworks seem to avoid using the NavigationWindow and Page controls in favor of composing pages using nested UserControls.

The

4条回答
  •  醉酒成梦
    2021-01-12 04:00

    "NavigationWindow does not store an instance of a content object in navigation history. Instead, NavigationWindow creates a new instance of the content object each time it is navigated to by using navigation history. This behavior is designed to avoid excessive memory consumption when large numbers and large pieces of content are being navigated to. Consequently, the state of the content is not remembered from one navigation to the next. However, WPF provides several techniques by which you can store a piece of state for a piece of content in navigation history...."

    http://msdn.microsoft.com/en-us/library/system.windows.navigation.navigationwindow.aspx

提交回复
热议问题