title: C#/XAML Error No overload for 'button_Click' matches delegate 'Windows.UI.Xaml.RoutedEventHandler'
body: <p>I am trying to switch between two previously defined styles in App.xaml for multiple buttons each time a button gets clicked. I tried a generic event handler but it will display the error <strong>No overload for 'button_Click' matches delegate 'Windows.UI.Xaml.RoutedEventHandler'</strong>. I believe it has to do with the signature but can't quite fix it. Here's the method implemented in MainPage.xaml.cs</p>
  
  <pre><code>public void button_Click(object sender, EventArgs e)
      {
          var button = (Button)sender;
          if (button.Style != myButtonStyle)
              button.Style = myButtonStylePressed;
          else
              button.Style = myButtonStyle;
      }
  </code></pre>
  
  <p>And this is how it is implemented in MainPage.xaml in one button sample.</p>
  
  <pre><code>&lt;Button Name="Row5Col4"
              Grid.Row ="5"
              Grid.Column ="4"
              Margin="10, 10, 10, 10"
              Height="10"
              Width="10" 
              HorizontalAlignment="Left"
              BorderThickness="0"
              Style="{StaticResource myButtonStyle}"
              Click="button_Click"
              &gt;
      &lt;/Button&gt;
  </code></pre>
  
  <p>IMPORTANT: some people have recommended using MouseClick instead of Click, however this won't work since it is a WP application. I appreciate you stopping by. </p>
  
  <p>The line that, according to Visual Studio causes the bug is this one
      <strong>Click="button_Click"</strong></p>