I searched MSDN for e.ClickCount, and it provieds the following eg.:
<textblock x:name="tb" text="" background="Black" foreground="White" />
and the code behind:
public partial class Window1 : Window
{
public Window1()
{
InitializeComponent();
this.tb.MouseDown += new MouseButtonEventHandler(tb_MouseDown);
}
void tb_MouseDown(object sender, MouseButtonEventArgs e)
{
if (e.ClickCount == 1)
{
this.tb.Text = "Single Click";
DoSomethingForClick();
}
if (e.ClickCount == 2)
{
this.tb.Text += "Double Click";
DoAnotherForDoubleClick();
}
if (e.ClickCount >= 3)
{
this.tb.Text += "Triple Click";
}
}
}
But what I want to get is like this:
(1)When I click once at one time, then execute
DoSomethingForClick()
. This has no problem!
(2)When I click twice at one time, then only execute
DoAnotherForDoubleClick()
. NOT firstly execute
DoSomethingForClick()
and then execute
DoAnotherForDoubleClick()
like in the MSDN eg., because tb_MouseDown fired 2 times;
How can I do?