title: WPF Button Click Event not working
body: <p>I have a button that contains an Image inside a grid, my problem is that I can't make the button <code>Click</code> event work.</p>
  
  <p>My XAML code:</p>
  
  <pre><code>....
  &lt;TabControl TabStripPlacement="Left"&gt;
      &lt;TabItem Loaded="ListProductsLoaded" Width="185" Height="100" Header="Lister les Produits"&gt;
          &lt;Grid Background="#FFE5E5E5"&gt;
              &lt;ListView Name="ProductsListView" IsHitTestVisible="False"&gt;
                  &lt;ListView.View&gt;
                      &lt;GridView&gt;
                          &lt;GridViewColumn Width="120" Header="Reference" DisplayMemberBinding="{Binding ProductReference}"&gt;&lt;/GridViewColumn&gt;
                          &lt;GridViewColumn Width="150" Header="Nom" DisplayMemberBinding="{Binding ProductName}"&gt;&lt;/GridViewColumn&gt;
                          &lt;GridViewColumn Width="120" Header="Photo" &gt;
                              &lt;GridViewColumn.CellTemplate&gt;
                                  &lt;DataTemplate&gt;
                                      &lt;Button PreviewMouseLeftButtonDown="ImageButtonLeftMouseButtonDown" Name="ImageButton" Width="120" Height="120" Click="ImageButtonClicked"&gt;
                                          &lt;Image Width="119" Height="119" Name="ProdImage" Source="{Binding ProductImage}"&gt;&lt;/Image&gt;
                                      &lt;/Button&gt;
                                  &lt;/DataTemplate&gt;
                              &lt;/GridViewColumn.CellTemplate&gt;
                          &lt;/GridViewColumn&gt;
                      &lt;/GridView&gt;
                  &lt;/ListView.View&gt;
              &lt;/ListView&gt;
          &lt;/Grid&gt;
      &lt;/TabItem&gt;
  &lt;/TabControl&gt;
  ....
  </code></pre>
  
  <p>As you can see I used two events, <code>PreviewMouseLeftButtonDown</code> event and Click event, I used <code>PreviewMouseLeftButtonDown</code> due to a solution I saw in a stackoverflow question but it didn't work. Both events methods display a <code>MessageBox</code></p>
  
  <pre><code>private void ImageButtonClicked(object sender, RoutedEventArgs e)
  {
      MessageBox.Show(this, "clicked image button");
  }
  
  private void ImageButtonLeftMouseButtonDown(object sender, MouseButtonEventArgs e)
  {
      MessageBox.Show("test clicked");
  }
  </code></pre>
  
  <p>If anyone encountered this problem before please help me solve it, I searched for a solution without success. Thanks in advance.</p>
  
  <p>Edit: Even if I use a normal button: No image in it, it doesn't work.</p>
  
  <p>Solution : Actually, i set the Option <code>IsHitTestVisible</code> of the <code>TabControl</code> to <code>false</code> and that disabled all <code>Click</code> events… sorry everybody.</p>