处理鼠标右键双击形状

时间:2012-06-14 12:52:55

标签: c# wpf mouseevent shape double-click

我如何处理ShapeMouse Right Button Double Click事件?

1 个答案:

答案 0 :(得分:5)

您是否正在寻找一种方法来检测双击Shape?在这种情况下,您应该检查ClickCount事件的MouseRightButtonDown属性。此属性提供单击元素的次数。文档页面上的示例检查单击,双击和三击:

private void OnMouseDownClickCount(object sender, MouseButtonEventArgs e)
{
    // Checks the number of clicks.
    if (e.ClickCount == 1)
    {
        // Single Click occurred.
        lblClickCount.Content = "Single Click";
    }
    if (e.ClickCount == 2)
    {
        // Double Click occurred.
        lblClickCount.Content = "Double Click";
    }
    if (e.ClickCount >= 3)
    {
        // Triple Click occurred.
        lblClickCount.Content = "Triple Click";
    }
}