-1

I have a ListBoxItem with a LeftClick Gesture:

<ListBoxItem x:Name="ListViewItemMenu" Content="{Binding Path=Header}" Padding="37 14" FontSize="15" Foreground="White">
    <ListBoxItem.InputBindings>
        <MouseBinding Gesture="LeftClick" Command="ApplicationCommands.New" />
    </ListBoxItem.InputBindings>
</ListBoxItem>

But actually it's not a real Click, it's simply a MouseLeftButtonDown Gesture. The Command is executed regardless of whether the button is raised or not after pressed.

I would like to have a complete Click with the MouseDown and MouseUp Gestures in the ListBoxItem. There is anyway to do that? Much appreciated.

Also I can't find a way to add a Command to an Expander. The method shown above to the ListBoxItem doesn't work. Any magic here? Thanks!

fpuglap
  • 109
  • 1
  • 2
  • 15

1 Answers1

0

According to this answer you can inherit from MouseGesture to create custom gestures. There is even a full example with implementation.

An alternative is to use an System.Windows.Interactivity.EventTrigger as shown in this answer, which would let you turn the MouseLeftButtonUp or PreviewMouseLeftButtonUp event into a command trigger.

Keith Stein
  • 6,235
  • 4
  • 17
  • 36