问题描述
我正在添加一些解决方法代码来修复,(当WPF TextBox更改已启用时,
可见
或 ReadOnly
声明,任何SpellCheck自定义字典都将被删除,直到您禁用并重新启用SpellCheck),最简单的修复程序似乎是处理 IsVisibleChanged
, IsEnabledChanged
和 IsReadOnlyChanged
事件。
I was adding some workaround code to fix the bug outlined in Is this a bug in DotNet 4 WPF Spell Checking?, (When a WPF TextBox changes Enabled,
Visible
or ReadOnly
states, any SpellCheck custom dictionaries get dropped off until you disable and re-enable SpellCheck) and the simplest fix seemed to be to handle the IsVisibleChanged
, IsEnabledChanged
, and IsReadOnlyChanged
events.
简单,对吧?除了是否 IsReadOnlyChanged
事件。任何人都知道为什么和什么最好的方式来陷入一个WPF文本框中的 IsReadOnly
?
Simple, right? Except there is no IsReadOnlyChanged
event. Anybody know why and what the best way to trap a change to IsReadOnly
in a WPF TextBox would be?
推荐答案
您可以随时使用
DependencyPropertyDescriptor.FromProperty(TextBoxBase.IsReadOnlyProperty)
.AddValueChanged(ctrl, OnReadOnlyChanged)
这篇关于为什么TextBox控件上没有IsReadOnlyChanged事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!