2

我定义了以下数据模板:

        <DataTemplate x:Key="hierarchicalTreeNodeTemplate">
            <TextBlock Text="{Binding Name}" 
                       MouseLeftButtonDown="treeViewTextBlock_MouseLeftButtonDown" 
                       KeyDown="treeViewTextBlock_KeyDown"
                       />
        </DataTemplate>

此数据模板用于呈现一些 WPF TreeViewItems。For some reason, the MouseLeftButtonDown handler is called as expected when user clicks on a tree item that happened to be a TextBlock, but the KeyDown handler is not called when the same item is selected and any keyboard key is pressed. 任何想法这里可能有什么问题?谢谢。

4

0 回答 0