Single click and double click on the same Image control(wpf)

守給你的承諾、 提交于 2019-12-05 13:23:01

If you use the MouseDown event instead it has a property in the EventArgs for ClickCount. This allows you to know how many times the user has clicked on the control within the system's double click time span.

You can probably use this to implement your own logic for deciding between a double and single click.

You can check double clicks using ClickCount property in the event args.

         if(e.ClickCount == 2)
         {
          // Do something here
         }

PS: If you are using MouseDown or MouseClick event make sure you are checking for left button double clicks.You can do this like :

           if (e.ChangedButton == MouseButton.Left && e.ClickCount == 2)
           { 
           // Do Something here
           }
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!