title: Drawing a line in canvas
body: <p>XAML</p>
  
  <pre><code>&lt;Canvas Name="canvas" MouseDown="canvas_MouseDown" MouseUp="canvas_MouseUp" /&gt;
  </code></pre>
  
  <p>C#</p>
  
  <pre><code>Point P1;
  private void canvas_MouseDown(object sender, MouseButtonEventArgs e)
  {
      P1 = e.GetPosition(canvas);
  }
  
  private void canvas_MouseUp(object sender, MouseButtonEventArgs e)
  {
      var P2 = e.GetPosition(canvas);
      canvas.Children.Add(new Line()
      {
          X1 = P1.X,
          Y1 = P1.Y,
          X2 = P2.X,
          Y2 = P2.Y,
          StrokeThickness = 3,
          Stroke = new SolidColorBrush { Color = Colors.Blue }
      });
  }
  </code></pre>
  
  <p>When I debug the events never get called, whether on mouse up or mouse down. Any idea why?</p>