How to navigate through windows with MVVM Light for WPF?

后端 未结 3 452
清歌不尽
清歌不尽 2020-12-12 23:03

I\'ve just started a new project in which the presentation layer will be done by WPF and MVVM Light by GalaSoft.

I need a lot of views and it\'s not clear to me how

3条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-12 23:36

    I usually use a ContentControl to display dynamic content. It's Content property is usually bound to a CurrentViewModel property in the parent ViewModel, and DataTemplates are used to tell WPF how to draw the child ViewModels.

    To change views, simply change the CurrentViewModel property in the parent ViewModel

    You can find an example at this article of mine

提交回复
热议问题