How do we separate click and double click on listview in WPF application?

前端 未结 3 524
自闭症患者
自闭症患者 2021-01-25 05:25

I have a WPF application. There is a listview in which a every time I click or double click, the click event fires up. Even if I keep the Click Event, it automatically fires up

3条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-25 06:14

    Add a handler to your control:

    
    ...
    
    

    The handler code:

    private void MyMouseHandler(object sender, MouseButtonEventArgs e)
    {
        if (e.ClickCount == 2)
        {
            //Handle here
        }
    }
    

提交回复
热议问题