Command を にバインドしようとしていTreeViewNode
ます。そのために私は持っTextBlock
ていて、アクションのために私はその中に持っHyperlink
ていてHyperlink
、コマンドにバインドされています:
<HierarchicalDataTemplate DataType="{x:Type vm:TreeNodeViewModel}" ItemsSource="{Binding Path=Children, Mode=OneWay}">
<StackPanel Orientation="Horizontal" Margin="2 0 4 0">
<Image Width="18" Height="18" Margin="0 0 4 0" Source="{Binding NodeImage}"/>
<TextBlock>
<Hyperlink Command="{Binding Path=NodeActionCommand}" TextDecorations="None" Foreground="Black" Focusable="False">
<Run Text="{Binding Path=Name, Mode=OneWay}"/>
<!--Following Input binding is not working-->
<Hyperlink.InputBindings>
<KeyBinding Key="Enter" Command="{Binding Path=NodeActionCommand}"/>
</Hyperlink.InputBindings>
</Hyperlink>
</TextBlock>
</StackPanel>
</HierarchicalDataTemplate>
ノードをマウスでクリックするとこの XAML が機能しますが、ツリー コマンドのノードでキーボード キーを押しEnter
てもトリガーされません。助けてください。