title: Wpf: Why does CaptureMouse() in OnMouseDown(...) raise OnMouseMove(...) event?
body: <p>Why does <code>CaptureMouse()</code> in <code>OnMouseDown(...)</code> raise <code>OnMouseMove(...)</code> event?</p>
  
  <pre><code>public partial class MainWindow : Window {
  
      public MainWindow() {
          InitializeComponent();
      }
  
  
      protected override void OnMouseDown(MouseButtonEventArgs e) {
          Trace.WriteLine( "OnMouseDown: Begin" );
          CaptureMouse();
          Trace.WriteLine( "OnMouseDown: End" );
      }
  
      protected override void OnMouseMove(MouseEventArgs e) {
          if (IsMouseCaptured) Trace.WriteLine( "OnMouseMove" );
      }
  
      protected override void OnMouseUp(MouseButtonEventArgs e) {
          Trace.WriteLine( "OnMouseUp" );
          ReleaseMouseCapture();
      }
  
  }
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>OnMouseDown: Begin
  OnMouseMove // Wtf???
  OnMouseDown: End
  OnMouseMove
  OnMouseMove
  OnMouseMove
  OnMouseUp
  </code></pre>
  
  <p><strong>Update</strong></p>
  
  <p><code>MouseDevice.Capture()</code> calls <code>MouseDevice.Synchronize()</code> which raises input event.</p>