Undo/Redo in WPF? [duplicate]
Asked Answered
R

2

5

Does WPF provide a framework to handle undo/redo? If not, what's a common way to do it?

Runty answered 23/4, 2009 at 0:4 Comment(0)
L
12

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.

Ludovico answered 21/6, 2011 at 2:59 Comment(1)
CodePlex is retiring. The repo lives here now: github.com/nathanaw/mufCoextend
I
2

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.

Integrate answered 18/4, 2011 at 8:35 Comment(2)
The "here" link is broken.Dramamine
Looks like that can now be found hereHeyer

© 2022 - 2024 — McMap. All rights reserved.