title: Cannot pass/bind click event to WPF user control
body: <p>I'm trying to pass a click event to an button in a WPF user control.</p>
  
  <p>the xaml part of my user control:</p>
  
  <pre><code> &lt;UserControl&gt;
      &lt;Grid&gt;
          &lt;Button Name="btnlrg"
              Command="{Binding Command, RelativeSource={RelativeSource AncestorType={x:Type local:ButtonLarge}}}"
              Click="{Binding Click, RelativeSource={RelativeSource AncestorType={x:Type local:ButtonLarge}}}"&gt;
              &lt;Button.Content&gt;
                  &lt;StackPanel Orientation="Horizontal"&gt;
                      &lt;!-- shortened --&gt;
                  &lt;/StackPanel&gt;
              &lt;/Button.Content&gt;
          &lt;/Button&gt;
      &lt;/Grid&gt;
  &lt;/UserControl&gt;
  </code></pre>
  
  <p>the c# part of my user control:</p>
  
  <pre><code>public partial class ButtonLarge : UserControl
  {
      public ButtonLarge()
      {
          InitializeComponent();
  
      }
  
      public string Text
      {
          get { return (string)GetValue(TextProperty); }
          set { SetValue(TextProperty, value); }
      }
  
      public static readonly DependencyProperty TextProperty =
        DependencyProperty.Register("Text", typeof(string), typeof(ButtonLarge), new UIPropertyMetadata(""));
  
      public ImageSource Image
      {
          get { return (ImageSource)GetValue(ImageProperty); }
          set { SetValue(ImageProperty, value); }
      }
  
      public static readonly DependencyProperty ImageProperty =
         DependencyProperty.Register("Image", typeof(ImageSource), typeof(ButtonLarge), new UIPropertyMetadata(null));
  
  
      //Make Commands available in UserControl
      public static readonly DependencyProperty CommandProperty = 
          DependencyProperty.Register("Command", typeof(ICommand), typeof(ButtonLarge));
  
      public ICommand Command
      {
          get { return (ICommand)GetValue(CommandProperty); }
          set { SetValue(CommandProperty, value); }
      }
  
      //Make Click Event available in UserControl
      public static readonly RoutedEvent ClickEvent = EventManager.RegisterRoutedEvent("Click", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(ButtonLarge));
  
       public event RoutedEventHandler Click
      {
          add { btnlrg.AddHandler(ButtonLarge.ClickEvent, value); }
          remove { btnlrg.RemoveHandler(ButtonLarge.ClickEvent, value); }
      }
  
  }
  </code></pre>
  
  <p>usage of the user-control:</p>
  
  <pre><code>&lt;ui:ButtonLarge Image="{StaticResource Icon}" Text="Ok" Click="newClickEvent"/&gt;
  </code></pre>
  
  <p>I can not go on here:( Can someone please help me?</p>