Creating an undo/redo system
Up until now we have been executing commands by using the
RelayCommand helper class. This allows us to separate the command implementation (in the ViewModel) from the view without creating a separate class for each command. Many applications need to not only execute commands, but also to undo already executed commands; the canonical case may be a text editor, but it can be anything. Let's see one way to build an undo/redo system that integrates with the commands infrastructure we've seen so far.
We'll use two projects we've already created. The first is
CH07.CookbookMVVM, our MVVM framework (which we'll expand), and there is also
CH07.BlogReader to demonstrate adding undo/redo capabilities.