title: WPF: Button single click + double click issue
body: <p>I have to handle both the single click and the double click of a button in a WPF application with different reaction.
  Unfortunately, on a doubleclick, WPF fires two click event and a double click event, so it's hard to handle this situation. </p>
  
  <p>It tried to solve it using a timer but without success...I hope you can help me.</p>
  
  <p>Lets see the code:</p>
  
  <pre><code>private void delayedBtnClick(object statInfo)
  {
      if (doubleClickTimer != null)
          doubleClickTimer.Dispose();
      doubleClickTimer = null;
  
      this.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new VoidDelegate(delegate()
      {
          // ... DO THE SINGLE CLICK ACTION
      }));
  }
  
  private void btn_Click(object sender, RoutedEventArgs e)
  {
      if (doubleClickTimer == null)
          doubleClickTimer = new Timer(delayedBtnClick, null, System.Windows.Forms.SystemInformation.DoubleClickTime, Timeout.Infinite);
          }
      }
  }
  
  private void btnNext_MouseDoubleClick(object sender, MouseButtonEventArgs e)
  {
      if (doubleClickTimer != null)
          doubleClickTimer.Change(Timeout.Infinite, Timeout.Infinite);    // disable it - I've tried it with and without this line
          doubleClickTimer.Dispose();
      doubleClickTimer = null;
  
      //.... DO THE DOUBLE CLICK ACTION
  }
  </code></pre>
  
  <p>The problem is that the 'SINGLE CLICK ACTION' called after the 'DOUBLE CLICK ACTION' on doubleclick. It's strange that I set the<code>doubleClickTimer</code> to null on double click but in the <code>delayedBtnClick</code> it's true :O </p>
  
  <p>I've already tried to use longer time, a bool flag and lock...</p>
  
  <p>Do you have any ideas?</p>
  
  <p>Best!</p>