为啥下面代码创建的文本框和下拉框不能使用搜狐输入法输入不能输入英文和数字 Grid grid = new Grid;gridRowDefinitionsAddnew RowDefinition Height = new GridLength70 ;gridRowDefinitionsAddnew RowDefinition Height = GridLengthAuto ;gridRowDef
可能是因为该代码中的TextBox控件和ComboBox控件没有设置输入语言,导致无法使用搜狐输入法输入英文和数字。可以尝试在创建这些控件时,设置输入语言为英文或中文,例如:
var text = new TextBox() { Margin = new Thickness(0, 5, 0, 5), FontSize = 17, Foreground = Brushes.Blue, VerticalAlignment = VerticalAlignment.Center, Width = 80, Language = XmlLanguage.GetLanguage("zh-CN") // 设置输入语言为中文 }; Grid.SetRow(text, i); Grid.SetColumn(text, j * 3 + 1); grid.Children.Add(text);
或者:
var comboBox = new ComboBox() { Margin = new Thickness(0, 5, 0, 5), FontSize = 17, Foreground = Brushes.Blue, VerticalAlignment = VerticalAlignment.Center, Width = 80, Language = XmlLanguage.GetLanguage("en-US") // 设置输入语言为英文 }; Grid.SetRow(comboBox, i); Grid.SetColumn(comboBox, j * 3 + 1); grid.Children.Add(comboBox)
原文地址: https://www.cveoy.top/t/topic/cZA2 著作权归作者所有。请勿转载和采集!