I have a FrameworkElement and I want to perform action A when the user single clicks, and action B when the user double clicks.
Due to the way events are delivered, I always get a single click event which begins action A. After looking around, I found an interesting technique here using a timer to delay the handling of the clicks. However, this example hardcodes the timer to 300 milliseconds, but I would prefer to use the user's "Double-click speed" setting Control Panel's Mouse Properties dialog.
What's the wpf/C# API for getting that value from the system?
You can find the time here: System.Windows.Forms.SystemInformation.DoubleClickTime
You can actually see a full implementation of what you are trying to achieve here:
WPF: Button single click + double click issue
If you don't want reference System.Windows.Forms assembly, you can try this:
[DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
public static extern int GetDoubleClickTime();
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