title: WPF: How do I use one User control for multiple different Click events
body: <p>I'm trying to create a User control for all the buttons on my homepage, every user control should have a different Click event. I'm trying to solve this by adding a property to the User control (which works for the label and image) but i can't find any solution for the Click event.</p>
  
  <p>ImageLabelButton.xaml:</p>
  
  <pre><code>&lt;UserControl x:Class="SC.UI.WPF.Controls.ImageLabelButton"
  &lt;Grid&gt;
      &lt;Button Name="BtnClick"&gt;
          &lt;StackPanel&gt;
                  &lt;Image Name="ImageButton"/&gt;
                  &lt;Label Name="LabelButton"/&gt;
          &lt;/StackPanel&gt;
      &lt;/Button&gt;
  &lt;/Grid&gt;
  </code></pre>
  
  <p></p>
  
  <p>ImageLabelButton.xaml.cs:</p>
  
  <pre><code>....
    &lt;!-- works --&gt;
    public string Name
    {
        get { return this.LabelButton.Content.ToString(); }
        set { this.LabelButton.Content = value; }
    }
    &lt;!-- works --&gt;
    public ImageSource SetSource
    {
        get { return ImageButton.Source; }
        set { ImageButton.Source = value; }
    }
    &lt;!-- doesn't work --&gt;
    public EventHandler ButtonAction
    {
        get { return BtnClick.Click; }
        set { BtnClick.Click= value; }
    }
  </code></pre>
  
  <p>Implementation.xaml:</p>
  
  <pre><code>....
  &lt;controls:ImageLabelButton Name="first" SetSource="test.png" ButtonAction="Click1"/&gt;
  &lt;controls:ImageLabelButton Name="first" SetSource="test.png" ButtonAction="Click2"/&gt;
  &lt;controls:ImageLabelButton Name="first" SetSource="test.png" ButtonAction="Click3"/&gt;
  </code></pre>