title: WPF ListBoxItem ControlTemplate breaks some MouseDown/Selection
body: <p>I have an issue with <code>ListBoxItem</code>s. I am trying to make all controls in the <code>ListBoxItem</code> select it as well, so clicking on a <code>TextBox</code>, <code>Label</code>, etc will select the <code>ListBoxItem</code>. Pretty simple so far. </p>
  
  <p>I am also changing the <code>ListBoxItem</code> Template to change the selection visualization from highlighting the background to just drawing a border. Also pretty simple. </p>
  
  <p>The combination of these two, however, seems to cause some really irritating issues with <code>MouseDown</code> and <code>PreviewMouseDown</code>, specifically in my case regarding <code>Label</code>s in a <code>Grid</code>, where one creates a "void" occupied by <code>Grid</code> space.</p>
  
  <p>Using snoop, I can see the <code>PreviewMouseDown</code> event stopping at the <code>ScrollViewer</code> inside the <code>ListBox</code>, and not going all the way to the <code>ListBoxItem</code>.</p>
  
  <p><img src="https://i.stack.imgur.com/r7gKU.png" alt="click no worky"></p>
  
  <p>XAML:</p>
  
  <pre><code>&lt;Window x:Class="ListBoxClickThroughTest.MainWindow"
          xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
          Title="MainWindow"
          Width="525"
          Height="350"&gt;
      &lt;Grid&gt;
          &lt;ListBox ItemsSource="{Binding Items}"
                   SelectionMode="Single"&gt;
  
              &lt;ListBox.ItemTemplate&gt;
                  &lt;DataTemplate&gt;
                      &lt;Grid&gt;
                          &lt;Grid.ColumnDefinitions&gt;
                              &lt;ColumnDefinition Width="Auto" /&gt;
                              &lt;ColumnDefinition Width="*" /&gt;
                          &lt;/Grid.ColumnDefinitions&gt;
                          &lt;Grid.RowDefinitions&gt;
                              &lt;RowDefinition /&gt;
                              &lt;RowDefinition /&gt;
                          &lt;/Grid.RowDefinitions&gt;
  
                          &lt;Label Name="VerySuperLongLabel"
                                 Grid.Row="0"
                                 Grid.Column="0"
                                 HorizontalAlignment="Left"
                                 Content="VerySuperLongLabel"
                                 Padding="0" /&gt;
  
                          &lt;TextBox Name="Textbox1"
                                   Grid.Row="0"
                                   Grid.Column="1"
                                   HorizontalAlignment="Stretch"
                                   HorizontalContentAlignment="Right"
                                   Text="Textbox1 Text" /&gt;
  
  
                          &lt;Label Name="ShortLabel"
                                 Grid.Row="1"
                                 Grid.Column="0"
                                 HorizontalAlignment="Left"
                                 Content="ShortLabel"
                                 Padding="0" /&gt;
                          &lt;TextBox Name="Textbox2"
                                   Grid.Row="1"
                                   Grid.Column="1"
                                   HorizontalAlignment="Stretch"
                                   HorizontalContentAlignment="Right"
                                   Text="Textbox2 Text" /&gt;
                      &lt;/Grid&gt;
                  &lt;/DataTemplate&gt;
              &lt;/ListBox.ItemTemplate&gt;
  
              &lt;ListBox.ItemContainerStyle&gt;
                  &lt;Style TargetType="{x:Type ListBoxItem}"&gt;
                      &lt;EventSetter Event="PreviewMouseDown"
                                   Handler="ListBoxItem_PreviewMouseDown" /&gt;
                      &lt;EventSetter Event="MouseDown"
                                   Handler="ListBoxItem_PreviewMouseDown" /&gt;
                      &lt;Setter Property="HorizontalContentAlignment" Value="Stretch" /&gt;
                      &lt;Setter Property="Template"&gt;
                          &lt;Setter.Value&gt;
                              &lt;ControlTemplate TargetType="{x:Type ListBoxItem}"&gt;
                                  &lt;Border x:Name="Bd"
                                          BorderThickness="1"&gt;
                                      &lt;ContentPresenter /&gt;
                                  &lt;/Border&gt;
                                  &lt;ControlTemplate.Triggers&gt;
                                      &lt;Trigger Property="IsSelected" Value="true"&gt;
                                          &lt;Setter TargetName="Bd" Property="BorderBrush" Value="Gray" /&gt;
                                      &lt;/Trigger&gt;
                                  &lt;/ControlTemplate.Triggers&gt;
                              &lt;/ControlTemplate&gt;
                          &lt;/Setter.Value&gt;
                      &lt;/Setter&gt;
                  &lt;/Style&gt;
              &lt;/ListBox.ItemContainerStyle&gt;
          &lt;/ListBox&gt;
  
      &lt;/Grid&gt;
  &lt;/Window&gt;
  </code></pre>
  
  <p>Code-behind:</p>
  
  <pre><code>using System.Collections.Generic;
  using System.Windows;
  using System.Windows.Controls;
  using System.Windows.Input;
  
  namespace ListBoxClickThroughTest
  {
      /// &lt;summary&gt;
      /// Interaction logic for MainWindow.xaml
      /// &lt;/summary&gt;
      public partial class MainWindow : Window
      {
          public MainWindow()
          {
              Items = new List&lt;string&gt;() { "1", "2" };
              InitializeComponent();
              DataContext = this;
          }
  
          public List&lt;string&gt; Items { get; set; }
  
          private void ListBoxItem_PreviewMouseDown(object sender, MouseButtonEventArgs e)
          {
              var listBoxItem = (ListBoxItem)sender;
              listBoxItem.IsSelected = true;
          }
      }
  }
  </code></pre>
  
  <p>However, if I remove the <code>Template</code> setter, all is well. Is there some magic in the template I'm missing? I tried renaming the border to "Bd" as that was what the default template border was named, but no luck. Any ideas?</p>