Building ViewModels based on nested Model Entities in WPF and MVVM Pattern

后端 未结 4 1779
南方客
南方客 2021-02-05 17:22

I have a problem understanding how to build view models based on the following models

(I simplified the models to be clearer)

public class Hit
{
   publi         


        
4条回答
  •  名媛妹妹
    2021-02-05 18:05

    I think I had the same problem and if you do it like "PatternViewModel with an ObservableCollection" you also get a massive impact on your performance because you start duplicating data.

    My approach was to build - for your expample - a PatternViewModel with a ObservableCollection. It's no contradiction to MVVM because the view is bound to the collection.

    This way you may avoid the duplication of the relationships.

提交回复
热议问题