2017-11-16 9 views
-1

누구나 이런 움라우트 문자로 키 바인딩 이벤트가 작동하지 않는 이유를 말할 수 있습니까?WPF XAML에서 움라우트 문자로 KeyBinding 이벤트 추가

enter image description here

오류가 발생합니다 XAML

<Grid.InputBindings> 
    <KeyBinding Key="Ü" ... /> 
</Grid.InputBindings> 

에 노력 : KeyBinding.Key 열거입니다

Cannot convert string value 'Ü' to type System.Windows.Input.Key

답변

1

나는 작은 시험 프로그램을 만들어 어느 Key이 무엇인지 알아 냈습니다.

Ü = Key.Oem1 
Ö = Key.Oem3 
Ä = Key.OemQuotes 
+0

이 질문에 https://stackoverflow.com/questions/582403/what-are-the :

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); } 

당신에게 시간을 절약하기 위해 : 새로운 WPF 프로젝트를 확인하고 메인 창 CS-파일에 추가 -emem-keys-in-the-system-windows-forms-keys-enumeration은 이들이 키보드 제조업체와 함께 변경 될 수 있음을 제안하므로 OP는 다른 솔루션을 찾아야 할 수도 있습니다 ... – Will

+0

@Will, 방금 화난 고객으로부터 2 명을 구했습니다. , 감사. 내 솔루션을 따르려면 소프트웨어에서 키를 재정의하는 메커니즘을 제공해야합니다. – Sinatr

+0

@Sinatr : 정말 고마워요. 이제 이해하고 작동하게 할 수 있습니다. –

2

때문에, 모든 가능한 값 here을 볼 수 있습니다. 움라우트 문자는 해당 열거 형의 일부가 아니기 때문에 사용할 수 없습니다.