2

次の内容のラベルがあります: Fol_Der(Alt ショートカットの d に下線が引かれたフォルダー)。

対象となる要素は Expander です。

Alt私の目標は、ユーザーが+を押すDと Expander が展開されることです。

ただし、押したときに得られるのは破線のアウトラインだけです。

破線のエキスパンダー

拡大するように適切にターゲットにするにはどうすればよいですか?

4

1 に答える 1

2

コマンドを定義する

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 はエキスパンダーを展開する必要があります

詳細については、コマンドの概要を参照してください。

于 2013-02-24T13:55:39.673 に答える