In my WPF application , I am using ListView GridView, and I implemented a functionality that is associated to mouse double click. Is there a way, or a control that distinguish between the mouse double click and mouse click?
I used a button, and implemented an event for mousedoubleclick, but the click event is still triggering
Thanks for help
Typically, a single click initiates a user interface action and a double-click extends the action. For example, one click usually selects an item, and a double-click edits the selected item.
1. Double-click is a term used to describe the process of quickly pressing a mouse button twice while keeping it still. In most cases, a double-click is with the left mouse button and is used to open or execute a file, folder, or software program.
To detect double clicks with JavaScript you can use the event listener dblclick . The dblclick event is supported in all modern browsers for desktop/laptops, even Internet Explorer 11.
If you want to make it easier to click and select things in Windows 10, try using the single click option. The double-click has long been a convention for launching applications or opening files or folders in Windows. The single click, meanwhile, is used for selecting items.
Handling the double click event for controls that present the MouseDoubleClick
event is no trick. Handling double click for other controls involves inspecting the ClickCount
property of the MouseButtonEventArgs
.
So, for instance, your XAML might look something like this:
<SomeControl MouseDown="MyMouseDownHandler">
...
</SomeControl>
... and your code behind like this:
private void MyMouseDownHandler(object sender, MouseButtonEventArgs e)
{
if (e.ClickCount == 2)
{
// Handle double-click
}
}
Here's a page that provides a somewhat more detailed example.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With