Click here to Skip to main content
13,293,101 members (96,025 online)
Rate this:
Please Sign up or sign in to vote.
See more:
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()
            this.tb.MouseDown += new MouseButtonEventHandler(tb_MouseDown);
        void tb_MouseDown(object sender, MouseButtonEventArgs e)
             // Checks the number of clicks. 
            if (e.ClickCount == 1)
                 // Single Click occurred.
                 this.tb.Text = "Single Click";
             if (e.ClickCount == 2)
                 // Double Click occurred.
                 this.tb.Text += "Double Click";
             if (e.ClickCount >= 3)
                 // Triple Click occurred.
                 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?
Posted 25-Sep-12 16:07pm
Updated 26-Sep-12 0:30am
Sergey Alexandrovich Kryukov 25-Sep-12 21:23pm
I'm sure you can do it, but why? Imagine the confusion of the user. Can you always distinguish it by yourself what it was: two separate clicks or a double click? I would rather review the conception of your UI and usability.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

I think your problem is caused by the system sending the following stream of messages for each 'double click' (check 'WM_LBUTTONDBLCLK' on msdn).


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01 | 2.8.171207.1 | Last Updated 26 Sep 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100