在 WPF 中撤消/重做?
WPF 是否提供了处理撤消/重做的框架? 如果没有,常见的方法是什么?
Does WPF provide a framework to handle undo/redo? If not, what's a common way to do it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我已经为 WPF 应用程序实现了撤消/重做,并最终将我的撤消/重做代码发布到 http://muf.codeplex .com/。
您还可以通过 NuGet 获取它。 只需查找“MUF”或“受监控的撤消框架”即可。 它包括对 Silverlight 4.0 以及 .NET 3.5、4.0 和 WP7 的支持。
欢迎在 codeplex 网站 ( http://muf.codeplex.com/ ) 上提出意见和问题。 您还可以在那里找到完整的文档和示例应用程序。
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.
从 .NET 3.0 开始,这是快速获取本地化名称、按键手势和某些功能的方法:
但是,如果您不进行进一步操作,每个 TextBox 都会维护其自己的撤消/重做列表,并且重做/撤消命令仅影响该项目目前有焦点。
必须有某种方法可以切换到单个窗口/应用程序范围的撤消/重做列表,但我刚刚开始搜索,大多数情况下我找到了“如何自己编码”文章。
但是使用附加属性的技术,描述了 这里,似乎很有前途,并且可能很容易/稳定。
As of .NET 3.0, this is the way to get the localized Name, Key Gesture and some functionality quick:
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.