title: C# WPF - DragMove and click
body: <p>I need a control to call DragMove() for a Window on MouseLeftButton down, but still function when clicked.</p>
  
  <p>If DragMove() is called, Click and MouseLeftButtonUp are not ever fired because DragMove() is a blocking call until they release the mouse button.</p>
  
  <p>Does anyone know a workaround to make this work?</p>
  
  <p>I have tried this hack based on Thread.Sleep which allows a click to work if it's quicker than 100 milliseconds, but it does not work reliably for users:</p>
  
  <pre><code>                ThreadPool.QueueUserWorkItem(_ =&gt;
                      {
                          Thread.Sleep(100);
  
                          Dispatcher.BeginInvoke((Action)
                              delegate
                              {
                                  if (Mouse.LeftButton == MouseButtonState.Pressed)
                                  {
                                      window.DragMove();
                                  }
                              });
                      });
  </code></pre>
  
  <p>EDIT: Well this hack worked...</p>
  
  <pre><code>                window.DragMove();
                  RaiseEvent(new MouseButtonEventArgs(e.MouseDevice, e.Timestamp, MouseButton.Left) 
                      { 
                          RoutedEvent = MouseLeftButtonUpEvent 
                      });
  </code></pre>
  
  <p>Anyone have a better one?</p>