Pergunta

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?

Foi útil?

Solução

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top