为啥下面代码创建的文本框和下拉框只能使用微软拼音中文不能输入法不能输入字符进去Grid grid = new Grid;gridRowDefinitionsAddnew RowDefinition Height = new GridLength70 ;gridRowDefinitionsAddnew RowDefinition Height = GridLengthAuto ;gridRowD
这可能是因为在创建文本框和下拉框时,没有设置输入法属性。可以在创建文本框和下拉框时添加以下代码:
var text = new TextBox() { Margin = new Thickness(0, 5, 0, 5), FontSize = 17, Foreground = Brushes.Blue, VerticalAlignment = VerticalAlignment.Center, Width = 80, InputMethod.IsInputMethodEnabledProperty = false, // 禁用输入法 IsEnabled = true // 启用文本框 };
var comboBox = new ComboBox() { Margin = new Thickness(0, 5, 0, 5), FontSize = 17, Foreground = Brushes.Blue, VerticalAlignment = VerticalAlignment.Center, Width = 80, InputMethod.IsInputMethodEnabledProperty = false, // 禁用输入法 IsEnabled = true // 启用下拉框 };
这样就可以禁用微软拼音输入法,允许使用其他输入法和输入字符了
原文地址: https://www.cveoy.top/t/topic/cZBJ 著作权归作者所有。请勿转载和采集!