Search code examples
windows-phone-7mouseleftbuttonup

Prevent MouseLeftButtonUp fire when releasing "Hold"?


I have a ListBox that contains the users favorite stuff. When you click(MouseLeftButtonUp) on an item in the list, you will navigate to "detailspage". If you hold down the listitem it will be deleted. This is performed by the "Hold" event

The problem is that MouseLeftButtonUp will fire when you relese the listitem. Is there a way to prevent the MouseLeftButtonUp to fire? I have seen this behaviour in another app.


Solution

  • MouseLeftButtonUp will always fire in this case. You need to use a boolean field or similar to test whether it was a short tap or a hold.

    To avoid this problem I would recommend using the Tap gesture instead of MouseLeftButtonUp.