title: WPF handling RoutedEvent from UserControl
body: <p>I have a UserControl, default one generated by VS, only TextBlock is added:</p>
  
  <pre><code>&lt;UserControl x:Class="MyNameSpace.Presentation.MyControl"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  x:Name="myControl"&gt;
      &lt;Grid&gt;
          &lt;TextBlock x:Name="SomeTextBox" Text="SomeText"&gt;&lt;/TextBlock&gt;
      &lt;/Grid&gt;
  </code></pre>
  
  <p></p>
  
  <p>Now, I put several instances of this control into parent control's WrapPanel dynamically from the code behind. I want to handle all Left Mouse Button clicks from MyControl instances. I have following code:</p>
  
  <pre><code>&lt;UserControl x:Class="Minimo.Presentation.FirstParent"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:Presentation="clr-namespace:Minimo.Presentation"
  Height="300" Width="300"&gt;
  &lt;WrapPanel Name="wrapPanelOfMyControls" MyControl.MouseLeftButtonDown="WrapPanel1_OnMouseLeftButtonDown"&gt;
  &lt;/WrapPanel&gt;
  </code></pre>
  
  <p></p>
  
  <p>In the event handler I make some action, and it works. However I get the following error when editing the XAML file:
  The attachable property 'MouseLeftButtonDown' was not found in type 'MyControl'. How to fix this?</p>