문제

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