diff --git a/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/TaskbarIcon.Declarations.cs b/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/TaskbarIcon.Declarations.cs
index a12c56e..d7157d9 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/TaskbarIcon.Declarations.cs
+++ b/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/TaskbarIcon.Declarations.cs
@@ -828,6 +828,33 @@ namespace Hardcodet.Wpf.TaskbarNotification
#endregion
+ #region NoLeftClickDelay dependency property
+
+ ///
+ /// Set to true to make left clicks work without delay.
+ ///
+ public static readonly DependencyProperty NoLeftClickDelayProperty =
+ DependencyProperty.Register("NoLeftClickDelay",
+ typeof(bool),
+ typeof(TaskbarIcon),
+ new FrameworkPropertyMetadata(false));
+
+
+ ///
+ /// A property wrapper for the
+ /// dependency property:
+ /// Set to true to make left clicks work without delay.
+ ///
+ [Category(CategoryName)]
+ [Description("Set to true to make left clicks work without delay.")]
+ public bool NoLeftClickDelay
+ {
+ get { return (bool)GetValue(NoLeftClickDelayProperty); }
+ set { SetValue(NoLeftClickDelayProperty, value); }
+ }
+
+ #endregion
+
//EVENTS
#region TrayLeftMouseDown
diff --git a/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/TaskbarIcon.cs b/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/TaskbarIcon.cs
index 884eedc..f24b65c 100644
--- a/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/TaskbarIcon.cs
+++ b/Hardcodet.NotifyIcon.Wpf/Source/NotifyIconWpf/TaskbarIcon.cs
@@ -67,6 +67,14 @@ namespace Hardcodet.Wpf.TaskbarNotification
///
private readonly Timer singleClickTimer;
+ ///
+ /// The time we should wait for a double click.
+ ///
+ private int doubleClickWaitTime
+ {
+ get { return NoLeftClickDelay ? 0 : WinApi.GetDoubleClickTime(); }
+ }
+
///
/// A timer that is used to close open balloon tooltips.
///
@@ -409,7 +417,7 @@ namespace Hardcodet.Wpf.TaskbarNotification
LeftClickCommand.ExecuteIfEnabled(LeftClickCommandParameter, LeftClickCommandTarget ?? this);
ShowTrayPopup(cursorPosition);
};
- singleClickTimer.Change(WinApi.GetDoubleClickTime(), Timeout.Infinite);
+ singleClickTimer.Change(doubleClickWaitTime, Timeout.Infinite);
isLeftClickCommandInvoked = true;
}
else
@@ -431,7 +439,7 @@ namespace Hardcodet.Wpf.TaskbarNotification
LeftClickCommand.ExecuteIfEnabled(LeftClickCommandParameter, LeftClickCommandTarget ?? this);
ShowContextMenu(cursorPosition);
};
- singleClickTimer.Change(WinApi.GetDoubleClickTime(), Timeout.Infinite);
+ singleClickTimer.Change(doubleClickWaitTime, Timeout.Infinite);
isLeftClickCommandInvoked = true;
}
else
@@ -450,7 +458,7 @@ namespace Hardcodet.Wpf.TaskbarNotification
{
LeftClickCommand.ExecuteIfEnabled(LeftClickCommandParameter, LeftClickCommandTarget ?? this);
};
- singleClickTimer.Change(WinApi.GetDoubleClickTime(), Timeout.Infinite);
+ singleClickTimer.Change(doubleClickWaitTime, Timeout.Infinite);
}
}