title: What is the correct way to have a click event fire on Button with a Border
body: <p>I've added some styling to an application's buttons and now the click event only fires if you click on the text of the button (because it fires the TextBox click event which bubbles up).  </p>
  
  <p>Here's the Snoop trace of two clicks on the button. The first click was inside the button but outside the text area.  The second click fired the event to show the <em>Click detected</em> MessageBox:</p>
  
  <p><a href="https://i.stack.imgur.com/3zsba.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3zsba.jpg" alt="enter image description here"></a></p>
  
  <p>app.xaml:</p>
  
  <pre><code>&lt;Application x:Class="WpfApplication1.App"
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
           xmlns:local="clr-namespace:WpfApplication1"
           StartupUri="MainWindow.xaml"&gt;
  &lt;Application.Resources&gt;
      &lt;Style x:Key="RoundedButton" TargetType="{x:Type Button}"&gt;
          &lt;Setter Property="HorizontalContentAlignment" Value="Center"/&gt;
          &lt;Setter Property="VerticalContentAlignment" Value="Center"/&gt;
          &lt;Setter Property="Padding" Value="1"/&gt;
          &lt;Setter Property="Height" Value="26"/&gt;
          &lt;Setter Property="Template"&gt;
              &lt;Setter.Value&gt;
                  &lt;ControlTemplate TargetType="Button"&gt;
                      &lt;Border CornerRadius="5" BorderBrush="LightGray" BorderThickness="2" Padding="2"&gt;
                          &lt;ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" /&gt;
                      &lt;/Border&gt;
                  &lt;/ControlTemplate&gt;
              &lt;/Setter.Value&gt;
          &lt;/Setter&gt;
      &lt;/Style&gt;
  &lt;/Application.Resources&gt;
  </code></pre>
  
  <p></p>
  
  <p>MainWindow.xaml</p>
  
  <pre><code>&lt;Window x:Class="WpfApplication1.MainWindow"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
      xmlns:local="clr-namespace:WpfApplication1"
      mc:Ignorable="d"
      Title="MainWindow" Height="88.298" Width="223.936"&gt;
  &lt;Grid&gt;
      &lt;Button Name="ClickMe" Width="70" Margin="0,0,30,0" Style="{DynamicResource RoundedButton}" Click="ClickMe_Click"&gt;Click Me&lt;/Button&gt;
  &lt;/Grid&gt;
  </code></pre>
  
  <p></p>
  
  <p>MainWindow.cs</p>
  
  <pre><code>namespace WpfApplication1
  {
      public partial class MainWindow : Window
      {
          public MainWindow()
          {
              InitializeComponent();
          }
  
          private void ClickMe_Click(object sender, RoutedEventArgs e)
          {
              MessageBox.Show("Click detected");
          }
      }
  }
  </code></pre>