0
내가 New
, Edit
및 Delet
, 나는 InputBinding
이 단축키를 설정하고있어 내 사용자 지정 명령을 만들 수 있었지만, 그것은 매우 어려운 작업이다 나는 때마다 내 명령커스텀 커맨드의 기본 핫키를 설정하는 방법은 무엇입니까?
Copy
명령 예제를 사용할 필요가있을 때, 난 몰라 단축키를 설정해야하지만 기본 단축키가 있습니다. Ctrl + C
고객 명령에 기본 단축키 Ctrl + N, Ctrl + E 및 Ctrl + D를 어떻게 설정할 수 있습니까?
public static class HWCommand
{
static RoutedUICommand save = new RoutedUICommand("Save", "Save", typeof(HWCommand));
static RoutedUICommand novo = new RoutedUICommand("Novo", "Novo", typeof(HWCommand));
static RoutedUICommand deletar = new RoutedUICommand("Deletar", "Deletar", typeof(HWCommand));
static RoutedUICommand editar = new RoutedUICommand("Editar", "Editar", typeof(HWCommand));
public static RoutedUICommand Save { get { return save; } }
public static RoutedUICommand Novo { get { return novo; } }
public static RoutedUICommand Deletar { get { return deletar; } }
public static RoutedUICommand Editar { get { return editar; } }
}
내 CommandBinding을 당신이 할 수있는
<Window.CommandBindings>
<CommandBinding Command="{x:Static hw:HWCommand.Novo}" Executed="NovoCommand_Executed"/>
<CommandBinding Command="{x:Static hw:HWCommand.Editar}" Executed="EditarCommand_Executed" CanExecute="EditCommand_CanExecuted"/>
<CommandBinding Command="{x:Static hw:HWCommand.Deletar}" Executed="DeletarCommand_Executed" CanExecute="DeletarCommand_CanExecuted"/>
</Window.CommandBindings>
당신에게의 감사 많이! 그것은 일하고있다! 하지만 ... 다른 질문은 ... InputGestureCollection을 허용하므로이 명령에 대해 하나 이상의 단축키를 설정할 수 있습니까? – Lai32290
기술적으로 ['KeyGestures'] (http://msdn.microsoft.com/en-us/library/system.windows.input.keygesture.aspx)를 포함하는'InputGestures'의 전체 목록을 넣을 수 있습니다. 그러나이 I 시도하지 않았다, ['MouseGesture'] (http://msdn.microsoft.com/en-us/library/system.windows.input.mousegesture.aspx) – dkozl