O'Reilly logo

Windows Presentation Foundation 4.5 Cookbook by Pavel Yosifovich

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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.

Getting ready

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.

How to do it... ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required