I have developed a simple Windows Forms application, which uses the MVC pattern as far as I can tell. I have done it successfully, but it raises a question: What if the model changes, can you think how we might notify a view/controller of this event?

What can we use instead of a Model? Is using delegates an answer?

有帮助吗?

解决方案

For tracking changes inside a Model, you can implement INotifyPropertyChanged interface in that Model class. Then any change in the Model instance will be reflected in the binded instance. For example, if you bind the IBindingList of that model to a DataGridView, then the gridview will be automatically updated on any change of that model.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top