次の内容のラベルがあります: Fol_Der
(Alt ショートカットの d に下線が引かれたフォルダー)。
対象となる要素は Expander です。
Alt私の目標は、ユーザーが+を押すDと Expander が展開されることです。
ただし、押したときに得られるのは破線のアウトラインだけです。
拡大するように適切にターゲットにするにはどうすればよいですか?
コマンドを定義する
public static RoutedUICommand ExpandFolderCommand{ get; private set; }
ExpandFolderCommand= new RoutedUICommand("ExpandFolderCommand", "ExpandFolderCommand", typeof(Commands), new InputGestureCollection {
new KeyGesture(Key.D, ModifierKeys.Alt, "Alt+D") });
次に、Window/UserControl でコマンド バインディングを定義します。
<UserControl.CommandBindings>
<CommandBinding Command="{x:Static ExpandFolderCommand}"
Executed="ExpandFolderCommand_Executed"
CanExecute="ExpandFolderCommand_CanExecute"/>
</UserControl.CommandBindings>
ExpandFolderCommand_Executed はエキスパンダーを展開する必要があります
詳細については、コマンドの概要を参照してください。