拖放操作重置文本框的撤消堆栈
我遇到了在文本框上执行放置操作时撤消堆栈被破坏的问题。
Reflector 没有提供任何关于 TextBox 如何处理此状态下的 Undo 堆栈的见解。
我还认为根本没有办法控制这个撤消堆栈,它完全是内部的。我在 MSDN 论坛上看到 MS 人员也说了很多同样的话。
任何人都知道如何防止文本框上的放置操作破坏其撤消历史堆栈?
I have an issue with the Undo stack being destroyed when doing a drop operation on a TextBox.
Reflector didn't give any insights on how the TextBox handles the Undo stack in this state.
I also see no way to control this Undo stack at all, that it is completely internal. I've seen the MS folks say much the same over at the MSDN forums.
Anyone have any ideas on how to prevent a drop action on a Textbox from destroying its Undo history stack?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这并不能完全回答您的问题,但您可以管理自己的文本框撤消堆栈。有许多撤消框架可以在这方面提供帮助,或者如果这是唯一需要自定义撤消的文本框,您也可以推出自己的框架。
我碰巧在 Codeplex 上维护这些撤消框架之一。 “受监控的撤消框架” 监视数据更改、存储更改的值并提供简单的撤消方法/ 重做这些更改。
我也研究了反射器中文本框的实现。该代码并不简单,并且似乎遍历了相当大的代码库来进行文本处理。据我所知,可用于调整文本框撤消的唯一旋钮是打开/关闭撤消。除此之外,它似乎是一个黑匣子。
This isn't quite answering your question, but you could manage your own undo stack for the textbox. There are a number of Undo frameworks to help in this area, or you could roll your own if this is the only textbox that needs custom undo.
I happen to maintain one of these undo frameworks on Codeplex. The "Monitored Undo Framework" watches for changes to the data, stores the changed values, and provides simple methods for undoing / redoing these changes.
I have looked at the implementation of the TextBox in reflector too. The code is not trivial and appears to traverse a pretty large codebase for text handling. As far as I know, the only knob available for tweaking a textbox's Undo is to turn undo on / off. Beyond that, it seems to be a black box.