相关问题(详情)
我有一个 WPF 画布,与 ContextMenu 相关联。
这很酷。现在我必须对 Right DoubleClick 执行一些操作...
事实上,我从来没有收到鼠标右键 ClickCount == 2 ...
该怎么办?
我需要在简单(右键)单击时显示 ContextMenu,并执行 Action2 OnRightDoubleClick..
protected override void OnPreviewMouseRightButtonUp(MouseButtonEventArgs e)
{
if (e.ClickCount == 1)
{
#region SINGLE CLICK
stillSingleClick = true;
Thread thread = new Thread(
new System.Threading.ThreadStart(
delegate()
{
Thread.Sleep(System.Windows.Forms.SystemInformation.DoubleClickTime);
this.Dispatcher.Invoke(
System.Windows.Threading.DispatcherPriority.Background,
new Action(
delegate()
{
if (stillSingleClick)
{
base.OnPreviewMouseRightButtonUp(e);
}
stillSingleClick = false;
}
));
}
));
thread.Start();
#endregion SINGLE CLICK
}
else if (e.ClickCount == 2)
{
stillSingleClick = false;
base.OnPreviewMouseRightButtonUp(e);
}
}