title: problem with wpf datagrid selection + expander
body: <p>I have an expander containing a datagrid with a rowdetailstemplate.</p>
  <p>When I click on a datagrid row to see the row details template, the expander closes!</p>
  <p>Anyone know why and how to fix this?</p>
  <h1>Update</h1>
  <p>Turns out that something else is happening:</p>
  <p>The expanders are all contained in a TabItem. When I click on the grid row, TabControls.SelectionChanged fires (WHY!!!?!?!!?!?!?!) and then the data is recalculated and rebound.</p>
  <p>So the real question is why does click a DataGrid row cause the Parent TabControl's SelectionChanged Event to fire? Here's the XAML:</p>
  <pre><code>&lt;Window xmlns:telerik=&quot;http://schemas.telerik.com/2008/xaml/presentation&quot;  x:Class=&quot;BPPDemo.MainWindow&quot;
      xmlns=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;
      xmlns:x=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;
      xmlns:local=&quot;clr-namespace:BPPDemo&quot;
      Title=&quot;BPP Demo&quot; Height=&quot;600&quot; Width=&quot;700&quot; Loaded=&quot;Window_Loaded&quot;&gt;
  
  &lt;Window.Resources&gt;
      &lt;local:AddrStatusColorConverter x:Key=&quot;addressStatusColorConverter&quot;/&gt;
  
      &lt;local:BoolToVisConverter x:Key=&quot;boolToVisConverter&quot;/&gt;
  &lt;/Window.Resources&gt;
  
  &lt;DockPanel&gt;
      &lt;Menu DockPanel.Dock=&quot;Top&quot;&gt;
          &lt;Menu.Items&gt;
              &lt;MenuItem Header=&quot;File&quot;&gt;
                  &lt;MenuItem Header=&quot;Open Assessment&quot; Command=&quot;{Binding SelectAssessmentCommand}&quot;&gt;&lt;/MenuItem&gt;
                  &lt;MenuItem Header=&quot;Import Properties&quot; Command=&quot;{Binding ImportPropertiesCommand}&quot;&gt;&lt;/MenuItem&gt;
              &lt;/MenuItem&gt;
              &lt;MenuItem Header=&quot;Properties&quot; Visibility=&quot;{Binding IsSelected, ElementName=tabProperties,Converter={StaticResource boolToVisConverter}}&quot;&gt;
                  &lt;MenuItem Header=&quot;Delete All Properties&quot; Command=&quot;{Binding DeleteAllPropertiesCommand}&quot;&gt;&lt;/MenuItem&gt;
                  &lt;MenuItem Header=&quot;Resolve Invalid Addresses&quot; Command=&quot;{Binding ValidateAddressesCommand}&quot;&gt;&lt;/MenuItem&gt;
                  &lt;MenuItem Header=&quot;Select Situs&quot; Command=&quot;{Binding SelectSitusCommand}&quot;/&gt;
              &lt;/MenuItem&gt;
          &lt;/Menu.Items&gt;
      &lt;/Menu&gt;
  
      &lt;DockPanel Margin=&quot;10&quot;&gt;
          &lt;TextBlock Text=&quot;{Binding Assessment.Name}&quot; FontWeight=&quot;Normal&quot; FontSize=&quot;24&quot; Foreground=&quot;#FF5C9EB7&quot; DockPanel.Dock=&quot;Top&quot; Margin=&quot;0,0,0,10&quot;/&gt;
          &lt;TabControl SelectionChanged=&quot;TabControl_SelectionChanged&quot;&gt;
              &lt;TabItem x:Name=&quot;tabProperties&quot; Header=&quot;Properties&quot;&gt;
                  &lt;DataGrid ItemsSource=&quot;{Binding Properties}&quot; AutoGenerateColumns=&quot;False&quot; IsReadOnly=&quot;True&quot; SelectedItem=&quot;{Binding SelectedProperty,Mode=TwoWay}&quot;&gt;
                      &lt;DataGrid.Columns&gt;
                          &lt;DataGridTextColumn Header=&quot;Description&quot; Binding=&quot;{Binding Description}&quot;/&gt;
                          &lt;DataGridTextColumn Header=&quot;Cost&quot; Binding=&quot;{Binding Cost,StringFormat='{}{0:c}'}&quot;/&gt;
                          &lt;DataGridTextColumn Header=&quot;Year Acquired&quot; Binding=&quot;{Binding YearAcquired}&quot;/&gt;
                          &lt;DataGridTextColumn Header=&quot;Life In Years&quot; Binding=&quot;{Binding LifeInYears}&quot;/&gt;
                          &lt;DataGridTextColumn Header=&quot;Schedule&quot; Binding=&quot;{Binding Schedule}&quot;/&gt;
                          &lt;DataGridTextColumn Header=&quot;Current Value&quot; Binding=&quot;{Binding CurrentValue,StringFormat='{}{0:c}'}&quot; /&gt;
                          &lt;DataGridTextColumn Header=&quot;Tax&quot; Binding=&quot;{Binding Tax,StringFormat='{}{0:c}'}&quot; /&gt;
  
                          &lt;DataGridTemplateColumn Header=&quot;Address&quot;&gt;
                              &lt;DataGridTemplateColumn.CellTemplate&gt;
                                  &lt;DataTemplate&gt;
                                      &lt;TextBlock Text=&quot;{Binding Address}&quot; Foreground=&quot;{Binding AddressStatus, Converter={StaticResource addressStatusColorConverter}}&quot;/&gt;
                                  &lt;/DataTemplate&gt;
                              &lt;/DataGridTemplateColumn.CellTemplate&gt;
                          &lt;/DataGridTemplateColumn&gt;
                          &lt;DataGridTextColumn Header=&quot;Address Status&quot; Binding=&quot;{Binding AddressStatus}&quot;/&gt;
                          &lt;DataGridTextColumn Header=&quot;Situs&quot; Binding=&quot;{Binding Situs}&quot;/&gt;
                      &lt;/DataGrid.Columns&gt;
  
                      &lt;DataGrid.RowDetailsTemplate&gt;
                          &lt;DataTemplate&gt;
                              &lt;TextBlock&gt;THIS ONE WORKS! WHY DOESN'T THE OTHER ONE????&lt;/TextBlock&gt;
                          &lt;/DataTemplate&gt;
                      &lt;/DataGrid.RowDetailsTemplate&gt;
  
  
                  &lt;/DataGrid&gt;
              &lt;/TabItem&gt;
              &lt;TabItem Header=&quot;Listings&quot; Name=&quot;tabListings&quot;&gt;
  
                  &lt;DataGrid x:Name=&quot;SitusGroups&quot; AutoGenerateColumns=&quot;false&quot; SelectionMode=&quot;Single&quot; SelectionUnit=&quot;FullRow&quot;&gt;
                      &lt;DataGrid.Columns&gt;
                          &lt;DataGridTextColumn Header=&quot;Situs&quot; Binding=&quot;{Binding Situs,StringFormat='{}{0:c}',TargetNullValue='none'}&quot;&gt;&lt;/DataGridTextColumn&gt;
                          &lt;DataGridTextColumn Header=&quot;Cost&quot; Binding=&quot;{Binding Cost,StringFormat='{}{0:c}'}&quot;&gt;&lt;/DataGridTextColumn&gt;
                          &lt;DataGridTextColumn Header=&quot;Value&quot; Binding=&quot;{Binding Value,StringFormat='{}{0:c}'}&quot;&gt;&lt;/DataGridTextColumn&gt;
                          &lt;DataGridTextColumn Header=&quot;Tax&quot; Binding=&quot;{Binding Tax,StringFormat='{}{0:c}'}&quot;&gt;&lt;/DataGridTextColumn&gt;
                      &lt;/DataGrid.Columns&gt;
  
                      &lt;DataGrid.RowDetailsTemplate&gt;
                          &lt;DataTemplate&gt;
                              &lt;TextBlock&gt;I JUST WANT TO SEE THIS WHEN I CLICK ON A ROW!&lt;/TextBlock&gt;
                          &lt;/DataTemplate&gt;
                      &lt;/DataGrid.RowDetailsTemplate&gt;
  
                  &lt;/DataGrid&gt;
  
                 
  
              &lt;/TabItem&gt;
          &lt;/TabControl&gt;
  
      &lt;/DockPanel&gt;
  
  &lt;/DockPanel&gt;
  </code></pre>