Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>2 Ways to go about this:</p> <ol> <li><p>Have your all logic on the ViewModel (POCO Models).</p> <p>You'll have to have your ViewModel contain an Undo/Redo stack. How you implement it is up to you, but I'd suggest just having the Undo/Redo stacks be of <code>Tuple&lt;String, Object&gt;</code>. Store the property name and the value of the property. It's easier than managing clones. It also gives you the ability for a poor mans "dirtiness" check by seeing if the UndoStack has any items on it.</p></li> <li><p>Give your models some interfaces such as IUndoRedo (Rich Models).</p> <p>You'll have to have your ViewModels call interface methods to Undo/Redo, but the idea is the same... have an Undo/Redo stack that is composed of <code>Tuple&lt;String, Object&gt;</code>.</p> <p>If you do decide to want to have a rich model approach, you can look at existing frameworks out there such as <a href="http://www.lhotka.net/cslanet/" rel="nofollow">CSLA.Net</a> which is made for rich models, though it might be a bit more than what you'll really need. Just throwing it out there in case you want to have really rich models.</p></li> </ol> <hr> <p>A side note: You're ObservableCollection (ItemsSource) should be of ViewModels, not Models. Just throwing that out there in case you were using the Models. That is, don't do <code>ObservableCollection&lt;IEmployee&gt;</code>, but rather <code>ObservableCollection&lt;EmployeeViewModel&gt;</code>. It makes things easier, much easier and more reusable!</p> <p>Another side note: try to avoid the DataGrid. It makes developers wanna rip their hair out. I'd just roll out your own "Grid" with ListView :)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload