1
InputBindings에 키 바인딩이 정의 된 창이 있습니다. 그들은 처음으로 작업 할 때 폼의 컨트롤에 초점을 맞 춥니 다.메시지 상자가 표시된 후 바로 가기 키가 작동하지 않습니다.
그러나 Messagbox가 표시되고 "OK"를 누르면 내 컨트롤의 포커스를 설정할 때까지 바로 가기 키가 작동하지 않습니다.
내있는 InputBindings :
<Window.InputBindings>
<KeyBinding Gesture="Ctrl+N" Command="{x:Static local:MainWindow.NewMenuCommand}" />
<KeyBinding Gesture="Ctrl+O" Command="{x:Static local:MainWindow.OpenMenuCommand}" />
<KeyBinding Gesture="Ctrl+S" Command="{x:Static local:MainWindow.SaveMenuCommand}" />
<KeyBinding Gesture="Ctrl+Q" Command="{x:Static local:MainWindow.CloseMenuCommand}" />
</Window.InputBindings>
내있는 CommandBindings : 나는 또한 얼마 전에이 문제를 직면
<Window.CommandBindings>
<CommandBinding Command="{x:Static local:MainWindow.NewMenuCommand}" Executed="NewEntity" />
<CommandBinding Command="{x:Static local:MainWindow.OpenMenuCommand}" Executed="OpenEntity" />
<CommandBinding Command="{x:Static local:MainWindow.SaveMenuCommand}" Executed="SaveEntity" />
<CommandBinding Command="{x:Static local:MainWindow.CloseMenuCommand}" Executed="CloseEntity" />
</Window.CommandBindings>
메시지 상자의 부모/소유자를 정의하지 않는 것과 관련이 있습니다. MessageBox.Show를 사용하여 대신에 을 (내게, "저장") : 있는 MsgBox ("저장") 는이 문제를 해결 제작 –
좋아, 실제로 내 경우에는 내가 구현 한 내 사용자 지정 메시지 상자 부모/자식 관계 설정도 나를 위해 작동하지 않았다. 그래서 위의 방법을 사용했습니다. –