I’m trying to find what mouse event I should use to place a Pushpin on a single click. I’ve tried using the MouseUp event but that event fires even when I just click-and-drag. Is there a way to have MouseUp fire only on clicks and not click-and-drags? Or is there another Mouse event that I should be looking at?
Clarification: I am working with the Bing Maps WPF control, not AJAX or Silverlight.
I’ve managed to hack this together by handling the
MouseLeftButtonDownandMouseLeftButtonUpevents.A
Stopwatchobject records how much time elapses between clicking down and releasing the click. This elapsed time is evaluated and determines whether or not it is a “click”.Warning: Remember to call
clickTimer.Reset()or yourStopwatchobject will continue to record clicks incrementally and only your first click (if you do not click-drag first) will trigger theifblock.Warning: Do not set
e.Handled=true. This will prevent click-drag events and your map will not pan properly.