有谁可以告诉我为什么键绑定事件不适用于像这样的变音字符?
尝试使用xaml
height: 100%
将抛出错误:
无法将字符串值“Ü”转换为
类型var ref2 = cordova.InAppBrowser.open(REMOTE_URL_HERE, '_blank', 'toolbar=yes');
答案 0 :(得分:3)
我制作了一个小型测试程序,以找出Key
是什么。制作新的WPF项目并添加到主窗口cs-file:
public MainWindow()
{
InitializeComponent();
var skip = new[] { Key.None, Key.DeadCharProcessed };
foreach (Key value in Enum.GetValues(typeof(Key)))
if (!skip.Contains(value))
InputBindings.Add(new KeyBinding { Command = new MyCommand(value.ToString()), Key = value });
}
public class MyCommand : ICommand
{
public event EventHandler CanExecuteChanged;
public string Text { get; }
public MyCommand(string text) { Text = text; }
public bool CanExecute(object parameter) => true;
public void Execute(object parameter) => MessageBox.Show(Text);
}
节省您的时间:
Ü = Key.Oem1
Ö = Key.Oem3
Ä = Key.OemQuotes
答案 1 :(得分:2)
由于KeyBinding.Key
是枚举,因此您可以看到所有可能的值here。由于您的变音字符不属于该枚举 - 您无法使用它。