Is there any way to detect whether a wpf control received mouse double click (couldn't find the MouseDoubleClick event)? Actually I am starting a storyboard animation on click of a button (in xaml) and getting wiered behaviour if user performs double click. As far as click (single) is concerned the application is working perfectly fine.
-
-
http://msdn2.microsoft.com/en-us/library/system.windows.controls.control.mousedoubleclick.aspx points to an event defined on Control (and thus available on Button as well) that may help you. Also note that ClickCount may help you.
Thanks, Rob
Rob Relyea | Program Manager, WPF & Xaml Language Team
robrelyea.com | /blog | /wpf | /xaml -
Thanks !

-
Rob,Rob Relyea said:http://msdn2.microsoft.com/en-us/library/system.windows.controls.control.mousedoubleclick.aspx points to an event defined on Control (and thus available on Button as well) that may help you. Also note that ClickCount may help you.Thanks, Rob
Rob Relyea | Program Manager, WPF & Xaml Language Team
robrelyea.com | /blog | /wpf | /xaml
The ClickCount fires each time the mouse is clicked. Thus if you DoubleClick, you will first get a value of 1, followed by a value of 2. What happens if you have a shape for instance that requires one action when a user single clicks on the shape and a different action when a user DoubleClicks on the same shape? I've seen a lot of postings with people suggesting the use of select case or an if then else statement but this will never work since even if you DoubleClick you will first get a value of 1. Even MSDN's sample uses if then, but you're always going to get the value of 1 followed by the value of 2 on DoubleClick.
Kindest regards,
-LT -
I am not rob but I think what has to be done is to have a time frame for counting 2 clicks as a "double click" + location of the #2 click.ltawes said:
Rob,Rob Relyea said:*snip*
The ClickCount fires each time the mouse is clicked. Thus if you DoubleClick, you will first get a value of 1, followed by a value of 2. What happens if you have a shape for instance that requires one action when a user single clicks on the shape and a different action when a user DoubleClicks on the same shape? I've seen a lot of postings with people suggesting the use of select case or an if then else statement but this will never work since even if you DoubleClick you will first get a value of 1. Even MSDN's sample uses if then, but you're always going to get the value of 1 followed by the value of 2 on DoubleClick.
Kindest regards,
-LT
for example *IF* 2 clicks arraive in less then n seconds and in a rect of size x,y then you have a "double click" event.
time and rect size need to be adaptable for a number of factors like user might be disabled
display resoulution -- larger pixel count might need a larger rect.
things like that....
-
Yeah, that's a tough one, but I wonder what these two actions you want to perform are. Usually when you doubleclick on something, the first click selects the item if it is not already selected, and the 2nd click within the doubleclick time window performs some action on the selection. Checking the ClickCount in MouseDown supports that scenario.ltawes said:
Rob,Rob Relyea said:*snip*
The ClickCount fires each time the mouse is clicked. Thus if you DoubleClick, you will first get a value of 1, followed by a value of 2. What happens if you have a shape for instance that requires one action when a user single clicks on the shape and a different action when a user DoubleClicks on the same shape? I've seen a lot of postings with people suggesting the use of select case or an if then else statement but this will never work since even if you DoubleClick you will first get a value of 1. Even MSDN's sample uses if then, but you're always going to get the value of 1 followed by the value of 2 on DoubleClick.
Kindest regards,
-LT
PS: Old thread.
Thread Closed
This thread is kinda stale and has been closed but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.