开发者

MVVM relations between viewmodel-view

开发者 https://www.devze.com 2023-03-09 06:55 出处:网络
I am an newbie in wpf and mvvm. I can\'t answer a base question... What relations should be in my application between model,viewmodel, view... One view-one viewmodel, or one model-one viewmodel? Or ma

I am an newbie in wpf and mvvm. I can't answer a base question... What relations should be in my application between model,viewmodel, view... One view-one viewmodel, or one model-one viewmodel? Or may be one v开发者_Go百科iewmodel-many view


  • one or more models => one view model
  • one view model => one view


You might find this Model-View-ViewModel (MVVM) article interesting. It discusses how the parts should be connected to each other.


A view has always a corresponding viewmodel. So the relation here is always "one view - one viewmodel". This viewmodel itself can have one or more models that provide the data, but it can also have one or more viewmodels as data provider. The point is that there can be way more viewmodel than views. Just to clarify this.

0

精彩评论

暂无评论...
验证码 换一张
取 消