title: Silverlight: How to Prevent Routing a MouseMove Event from a Child Canvas to Its Parent Canvas
body: <p>I have my XAML code:</p>
  
  <pre><code>&lt;Canvas x:Name="mainCanvas" Width="200" Height="150" Background="LightGray"
          MouseLeftButtonUp="mainCanvas_MouseLeftButtonUp"
          MouseMove="mainCanvas_MouseMove"&gt;
      &lt;Canvas x:Name="topCanvas" Width="200" Height="100" Background="LightBlue"
              MouseLeftButtonUp="topCanvas_MouseLeftButtonUp"
              MouseMove="topCanvas_MouseMove"&gt;
      &lt;/Canvas&gt;
  &lt;/Canvas&gt;
  </code></pre>
  
  <p>and its code behind:</p>
  
  <pre><code>private void topCanvas_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
  {
      MessageBox.Show("topCanvas_MouseLeftButtonUp");
  
      e.Handled = true; // This can prevent routing to the mainCanvas
  }
  
  private void mainCanvas_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
  {
      MessageBox.Show("mainCanvas_MouseLeftButtonUp");
  }
  
  private void topCanvas_MouseMove(object sender, MouseEventArgs e)
  {
      Debug.WriteLine("topCanvas_MouseMove");
  
      // How to prevent routing to the mainCanvas?
      // e.Handled = true does NOT exist in MouseEventArgs
  }
  
  private void mainCanvas_MouseMove(object sender, MouseEventArgs e)
  {
      Debug.WriteLine("mainCanvas_MouseMove");
  }
  </code></pre>
  
  <p>My question is already in the comments.</p>
  
  <p>How to prevent routing the MouseMove event from the topCanvas (the child canvas) to the mainCanvas (parent canvas)?</p>
  
  <p>Thanks.</p>
  
  <p>Peter</p>