When should I use a UserControl instead of a Page?

前端 未结 4 1609
长发绾君心
长发绾君心 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:14

    I just discovered another difference between UserControls and Pages: Pages cannot be used as DataTemplates.

    For example, if you were creating application using the MVVM style, you might expect this to work:

        
            
        
    

    But if the ProjectDashboardView is a Page, it will fail.

提交回复
热议问题