WPF ComboBox,强制输入到UpperCase [英] WPF ComboBox, force input to UpperCase
本文介绍了WPF ComboBox,强制输入到UpperCase的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个可编辑的WPF ComboBox与TextSearchEnabled。
I have an editable WPF ComboBox with TextSearchEnabled. I need to force the user's text input to uppercase when they type to filter the ComboBox.
我想要修改作为控件一部分的文本框(名为PART_EditableTextBox ')设置 CharacterCasing =Upper,但我不知道该怎么做。
I was thinking of modifying the textbox that is part of the control (named 'PART_EditableTextBox') to set CharacterCasing="Upper", however I can't quite figure out how to do this.
我需要使用
推荐答案
这是一个合理的解决方案:
This works and seems like a reasonable solution:
protected void winSurveyScreen_Loaded(object sender, RoutedEventArgs e)
{
(comboBox.Template.FindName("PART_EditableTextBox", cbObservation) as TextBox).CharacterCasing = CharacterCasing.Upper;
}
确保在加载时组合框未折叠,否则将找不到模板。
Ensure that the combobox is not collapsed on loaded otherwise the template will not be found.
这篇关于WPF ComboBox,强制输入到UpperCase的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文