Open schmitch opened 1 year ago
It might not be technically possible. Native platform API should be investigated if they provide this kind of information.
actually I‘m trying to port a wpf/windows forms application which does use that. But I’m unsure about linux.
(I tried the click event on macos and was confused why it didn’t work 😅, but yeah macos definitely has no support for it)
isn't double click just two single clicks in some time interval? it should be easily implemented, windows and osx has some functions to retrieve double click time, linux probably not
I was able to work around this limitation on Windows:
[DllImport("user32.dll")]
private static extern uint GetDoubleClickTime();
private DateTime? _trayTimeClick;
public void OnTrayClicked(object sender, EventArgs e)
{
if (_trayTimeClick == null) {
_trayTimeClick = DateTime.Now;
return;
}
var delta = (DateTime.Now - _trayTimeClick).Value;
if (delta.TotalMilliseconds > GetDoubleClickTime()) {
_trayTimeClick = DateTime.Now;
return;
}
_trayTimeClick = null;
// Do something when the icon is double clicked
}
<TrayIcon Icon="/Assets/Icon.ico" ToolTipText="Example" Clicked="OnTrayClicked">
Not sure how you would do this on Mac or Linux, but this is a possible workaround for anyone who needs it on Windows.
Is your feature request related to a problem? Please describe. add a way to track TrayIcon double clicks
Additional context at the moment double click events are not handled with the tray icon. (clicks are also only working in Linux/Windows)