Distinguish betweem clicking and dragging

Oct 18, 2009 at 11:29 AM

Hey Kevin,

is there any way to distinguish between clicking and dragging? I have a context menu which should be displayed on left mouse click but shouldn't when I do dragging.

Regards

Anton Kalcik

Coordinator
Nov 2, 2009 at 9:06 AM
Hello, as both your menu as the starting of a drag is initiated by a left mouse button click, I think this might be pretty hard to do... You could modify the source so the dragging only starts after the user "moved" the mouse while the left mouse button is down, but that would mean dragging would probably feel quite weird to the user. Kind regards, Kevin.
Aug 21, 2011 at 1:26 PM

 //mouse down 

 

//Handle left or right mouse buttons up event

clickTime =DateTime

.Now;  
 

 

//dragsource that should be replaced

Button_Down_at = e.GetPosition(element);

 

 

//mouse up

DateTime clickTimeUp = DateTime.Now;

 

 

 

 

TimeSpan

 

span = clickTimeUp - clickTime; 

Point Button_Up_at = e.GetPosition(element); 

if(span.TotalMilliseconds < 500 &&

mouseDown && 

Math.Abs(Button_Down_at.X - Button_Up_at.X) < 4 && Math

.Abs(Button_Down_at.Y - Button_Up_at.Y) < 4)

ListContent toBeReplacedContent = (ListContent)(((DragSource)sender).DataContext); .Relative));

 

 

NavigationService.Navigate(new Uri("/page2.xaml", UriKind

}