title: C# WPF Set button click event handler from a class static method
body: <p>Is there any way to set a button click routed event handler from a class static method?</p>
  
  <p>I have got UserControl item "SendButton" with a button in XAML and two arguments:</p>
  
  <pre><code>public SendButton(string buttonText, string eventHandler)
          {
              InitializeComponent();
              ButtonBlock.Content = buttonText;
  
              // This is what I´ve tried
              ButtonBlock.Click += (Func&lt;RoutedEventHandler&gt;) typeof(RoutedEvents).GetMethod(eventHandler);
  
              // This is what I want to achieve:
              // ButtonBlock.Click += RoutedEvents.WhatIsYourName();
              // But it doesn´t work anyways, because of a missing arguments
          }
  </code></pre>
  
  <p>And then static method inside the class</p>
  
  <pre><code>public class RoutedEvents
      {
          public static void WhatIsYourName(object sender, TextChangedEventArgs e)
          {
              // 
          }
      }
  </code></pre>
  
  <p>And this is how I would like to call it:</p>
  
  <pre><code>new SendButton("Send", "WhatIsYourName");  
  </code></pre>
  
  <p>Thank you</p>