Modifying an existing MVVM infrastructure by adding View State feature <p>I'm going to introduce View State feature in the existing MVVM WPF Application. The objective is to be able to Save and Load (restore) particular state of a control.</p> <p>The question is more about design and best solution from system flexibility/maintability perspectives.</p> <p><strong>Current infrastructure:</strong></p> <pre class="lang-cs prettyprint-override"><code>public abstract class ViewModelBase { protected ViewModelBase(...) { } } // and few more very the same ViewModel classes for different control types public sealed class GridViewModel : ViewModelBase { protected GridViewModel(...) : base(...) { } } </code></pre> <p>I'm introduced <code>IViewState interface</code> so each specific ViewModel could provide own implementation like <code>GridViewState class</code> and going to put it in ViewModel infrastructure in following way: (Idea is to pass type of ViewState as generic parameter)</p> <pre class="lang-cs prettyprint-override"><code>public abstract class ViewModelBase&lt;TViewState&gt; where TViewState : class, IViewState { protected ViewModelBase(...) { } public TViewState ViewState { ... } } </code></pre> <ol> <li>Is it a good idea to attach View State feature to ViewModel?</li> <li>Is it a good solution to introduce tied relation between specific ViewModel typa and ViewState through the generic Type parameter like <code>class GridViewModel&lt;GridViewState&gt;</code>?</li> <li>Where and why better to define such methods like <code>LoadState() / SaveState(),</code> <code>IViewState</code> itself or <code>ViewModelBase</code>?</li> <li>Are there another design solutions?</li> </ol>