为啥下面代码创建的文本框和下拉框不能使用搜狐输入法输入 Grid grid = new Grid;gridRowDefinitionsAddnew RowDefinition Height = new GridLength70 ;gridRowDefinitionsAddnew RowDefinition Height = GridLengthAuto ;gridRowDefinitionsA
可能是因为该代码没有设置输入法属性,导致无法使用搜狐输入法输入。可以尝试在创建文本框和下拉框时,设置输入法属性为搜狐输入法,例如:
var text = new TextBox() { Margin = new Thickness(0, 5, 0, 5), FontSize = 17, Foreground = Brushes.Blue, VerticalAlignment = VerticalAlignment.Center, Width = 80, InputMethod.IsInputMethodEnabledProperty = true, InputMethod.InputMethodPreference = new InputMethod { PreferredImeState = InputMethodState.On } }; Grid.SetRow(text, i); Grid.SetColumn(text, j * 3 + 1); grid.Children.Add(text);
同样的,在创建下拉框时也需要设置输入法属性
原文地址: https://www.cveoy.top/t/topic/cZz5 著作权归作者所有。请勿转载和采集!