title: c# WPF ListView Displays either Grouping of Data, but not both
body: <p>I have a bound ListView on a Window and I've setup XAML to do grouping, but when I try to apply it I either get only data or grouping with no data. The XAML is as follows:</p>
  
  <pre><code>&lt;ListView x:Name="lvNav" HorizontalAlignment="Left" Height="100" Margin="331,41,0,0" VerticalAlignment="Top" Width="166"&gt;
      &lt;ListView.View&gt;
          &lt;GridView&gt;
              &lt;GridViewColumn Header="Customer" DisplayMemberBinding="{Binding serviceID}" /&gt;
              &lt;GridViewColumn Header="S/N" DisplayMemberBinding="{Binding machineID}" /&gt;
          &lt;/GridView&gt;
      &lt;/ListView.View&gt;
  
      &lt;ListView.GroupStyle&gt;
  
           &lt;GroupStyle&gt;
               &lt;GroupStyle.ContainerStyle&gt;
                   &lt;Style TargetType="{x:Type GroupItem}"&gt;
                       &lt;Setter Property="Template"&gt;
                           &lt;Setter.Value&gt;
                               &lt;ControlTemplate&gt;
                                   &lt;Expander IsExpanded="True"&gt;
                                       &lt;Expander.Header&gt;
                                           &lt;StackPanel Orientation="Horizontal"&gt;
                                               &lt;TextBlock Text="{Binding Path=Name}" FontWeight="Bold" /&gt;
                                           &lt;/StackPanel&gt;
                                       &lt;/Expander.Header&gt;
                                   &lt;/Expander&gt;
                               &lt;/ControlTemplate&gt;
                           &lt;/Setter.Value&gt;
                       &lt;/Setter&gt;
                   &lt;/Style&gt;
               &lt;/GroupStyle.ContainerStyle&gt;
           &lt;/GroupStyle&gt;
       &lt;/ListView.GroupStyle&gt;
   &lt;/ListView&gt;
  </code></pre>
  
  <p>The code that loads the data is:</p>
  
  <pre><code>System.Data.Entity.DbSet&lt;srsr&gt; srsrs = _fa.srsrs;
  srsrs.Load();
  
  lvNav.ItemsSource = srsrs.Local;
  
  CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(lvNav.ItemsSource);
  PropertyGroupDescription pgd = new PropertyGroupDescription("stateID");
  view.GroupDescriptions.Add(pgd);
  </code></pre>
  
  <p>I'm assuming I'm missing something relatively simple here, so hopefully someone can point me in the right direction.</p>