Search code examples
wpfmousedouble-clickcontrolpanel

getting system's double click timer interval in WPF (value from control panel)


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?


Solution

  • 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