WPF:在可编辑的组合框中禁用撤消
我已经实现了一个基于 Memento 模式的撤消系统。我禁用了 TextBox 上的内置撤消功能,并且想知道如何在 ComboBox 上执行此操作。我的组合框是可编辑的,因此它包含一个文本框,我如何访问它以禁用其上的撤消操作。
我知道我可以从 ComboBox 派生添加一个属性并覆盖控件模板并在 TextBox 上设置该属性,但我想要一种方法在 xaml 的标准 ComboBox 上执行此操作。
I have implemented an undo system based on the Memento pattern. I disable the built in Undo on TextBox and was wondering how to do this on a ComboBox. The Combobox I have is editable, so it contains a TextBox, how do I access this to disable the Undo on it as well.
I know I can derive from ComboBox add a property and override the control template and set the property on the TextBox, but I would like a way to do this on the standard ComboBox from the xaml.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以从模板中查找它,如下所示:
You can look it up from the template like this:
我知道这已经 3 岁以上了,但也许它会对某人有所帮助。这基本上是 Rick 的回答,作为 decyclone 提到的行为:
I know this is 3+ years old but maybe it'll help someone. It is basically Rick's answer as a Behavoir that decyclone mentioned: