Does WPF provide a framework to handle undo/redo? If not, what's a common way to do it?
I've implemented undo / redo for a WPF application and ended up publishing my undo / redo code to http://muf.codeplex.com/.
You can also get it via NuGet. Just look for "MUF" or "Monitored Undo Framework". It includes support for Silverlight 4.0, as well as .NET 3.5, 4.0, and WP7.
Comments and questions are welcome on the codeplex site ( http://muf.codeplex.com/ ). You'll also find complete documentation and sample apps there.
As of .NET 3.0, this is the way to get the localized Name, Key Gesture and some functionality quick:
<MenuItem Command="ApplicationCommands.Redo"/>
<MenuItem Command="ApplicationCommands.Undo"/>
However, without further action on your part each TextBox maintains it's own Undo/Redo list and the Redo/Undo Command only affects the item currently having the focus. There must be some way to switch to a single, window/application wide undo/redo list, but I have just started to search and mostly I found "How to code it yourself" articles.
But a technique using attached properties, described here, seems very promising and could be easy/stable.
© 2022 - 2024 — McMap. All rights reserved.