wpf组合框可防止文本更改 [英] wpf combobox prevent text changed
问题描述
有什么方法可以防止wpf组合框在选择更改后更改其文本?我有一个从combobox派生的自定义控件,我希望能够在更改选择后手动设置文本,此外,我不能阻止base.OnSelectionChanged的调用(这可以解决问题,但它必须作为一部分保留在其中.要求)
is there any way to prevent wpf combobox from changing its text after selection changed? I have a custom control that derives from combobox and I want to be able to set the text manually after selection changed, additionally I cannot prevent the base.OnSelectionChanged from being invoked (this does the trick but it has to stay there as a part of requirements)
推荐答案
通常,ComboBox的IsEditable
和IsReadOnly
属性用于控制ComboBox的显示文本可被编辑或选择的级别.用户.
In general the IsEditable
and the IsReadOnly
properties of ComboBox are used to control the level to which the display Text of the ComboBox is editable or selectable by the user.
In the msdn combobox (section remarks) you can read about it.
这篇关于wpf组合框可防止文本更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!