title: Custom Button exception
body: <p>I am newbie in WPF and C# development. I am trying create my own button class based on standard WPF button.</p>
  <pre><code>public class _BaseButton : Button
  {
      public _BaseButton() : base()
      {
      }
  }
  </code></pre>
  <p>Then I try to place it in Window in XAML.</p>
  <pre><code>&lt;Window x:Class=&quot;Sample.MainWindow&quot;
                  xmlns=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;
      xmlns:x=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;
      xmlns:local=&quot;clr-namespace:Sample&quot;
      Title=&quot;MainWindow&quot; Height=&quot;350&quot; Width=&quot;525&quot;&gt;
      &lt;Grid &gt;
          &lt;local:_BaseButton Height=&quot;30&quot; Width=&quot;100&quot; Content=&quot;I am crashing&quot; VerticalAlignment=&quot;Center&quot; PreviewMouseLeftButtonDown=&quot;simpleButtonDetailCancelButton_PreviewMouseLeftButtonDown&quot;/&gt;
      &lt;/Grid&gt;
  &lt;/Window&gt;
  </code></pre>
  <p>As you can see, in XAML code I define handler of PreviewMouseLeftButtonDown event. It is implemented in window code behind.</p>
  <pre><code>public partial class MainWindow : Window
  {
      public MainWindow()
      {
          InitializeComponent();
      }
      
      private void simpleButtonDetailCancelButton_PreviewMouseLeftButtonDown(object sender, RoutedEventArgs e)
      {
      }
  }
  </code></pre>
  <p>The build of such a simple application finishes without errors. When I run  application, it crashes with following two exceptions:</p>
  <blockquote>
  <p>System.Windows.Markup.XamlParseException: Failed to create a PreviewMouseLeftButtonDown from the text simpleButtonDetailCancelButton_PreviewMouseLeftButtonDown. Line number 7 and line position 10.</p>
  <p>ArgumentException: Cannot bind to the target method because its signature or security transparency is not compatible with that of the delegate type.</p>
  </blockquote>
  <p>Could you explain me what I am doing wrong? Something is wrong with definition of the <code>PreviewMouseLeftButtonDown</code> event handler, or it is missing in base class, but I do not know what I have to do to fix it.</p>