Understanding View Models
A view model represents the state and behavior of a particular piece of UI—it is the non-framework-specific analogue of a control. Just as you can’t generally place the same control instance in two locations in a UI tree, you can’t also reuse the same view model instance.
If you could, we’d call it aÂ
ViewsModel
 🙂
–Bryan Watts
I remember spending time when learning MVVMlight debugging issues around the reuse of view models, and I thought such reuse was integral to MVVM. Â In then end, and with much regret, I tore out all this reuse, replacing it with very simple code that created a new view model when views were instantiated. Â I felt awful, scrapping the work that went into MVVMlight to do this. Â And yet, after reading the above quote, I feel a little vindicated. Â I’m sure there’s cases where you might want to keep a viewmodel instance around, but I’m still suspicious if this should be the default behavior.
Leave a Reply
No trackbacks yet.
No post with similar tags yet.
Posts in similar categories
About Me Sample Title
This is a sample text about you. You may login and go to the Dojuniko settings page and edit this text. Here you can display a summary of your website or anything that is interesting to your visitors. You also can disable this section completely. You have full control thru the settings page.