简体   繁体   English

如何正确实现 INotifyPropertyChanged? - C# MVVM WinForms

[英]How to properly implement INotifyPropertyChanged? - C# MVVM WinForms

Where to properly implement INotifyPropertyChanged?在哪里正确实施 INotifyPropertyChanged? In Model or ViewModel?在模型或视图模型中? And how do you do that having a 1-to-many relationship between two Models?你如何在两个模型之间建立一对多的关系?

Normally you do implement this on property setter.通常你会在属性设置器上实现它。

for more info check this link How to: Implement Property Change Notification有关更多信息,请查看此链接如何:实施属性更改通知

Jitendra Aanadani, I would add the implementation in your view-model , your model is suppose to be a simple class (poco). Jitendra Aanadani,我会在您的视图模型中添加实现,您的模型假设是一个简单的类(poco)。 I don't really know what you mean by "pull a list of children" but in my opinion if you need to get some additional data you should have a repository or some kind of service class which will provide you that Data.我真的不知道你所说的“拉出一个孩子列表”是什么意思,但在我看来,如果你需要获取一些额外的数据,你应该有一个存储库或某种服务类来为你提供这些数据。

I hope i could help you.我希望我能帮助你。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM