I am trying to have different behaviours when single clicking and double clicking the wpf Image control. Unfortunately the single click is fired first, so the double click is ignored.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
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.
回答2:
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
}