I have a TreeView and i use an ItemTemplate for the Item Bindings similar to this:
<TreeView ItemsSource="{Binding TreeViewItemCollection}">
<TreeView.ItemTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding Children}">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<StackPanel.InputBindings>
<MouseBinding Gesture="LeftDoubleClick" Command="{Binding Command}" CommandParameter="{Binding CommandParameter}"></MouseBinding>
</StackPanel.InputBindings>
<TextBlock Text="{Binding Name}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"></TextBlock>
</StackPanel>
</HierarchicalDataTemplate>
</TreeView.ItemTemplate>
</TreeView>
In the Ui it looks something like this :
Now if i doubleclick on the text the command triggers. When i doubleclick on the grey area nothing happens. How can i achieve this behaviour?