title: Why are Groups in WPF ListView empty?
body: <p>I have a class in my application with three properties <code>GroupName</code>, <code>ItemName</code>, and <code>Data</code>. I am have a <code>ListView</code> to group a collection of these classes by <code>GroupName</code> and display their <code>ItemName</code> property in a text box. The problem is that when I run the code, the groups appear correctly but none of them display any members.</p>
  
  <p>Here is the xaml code:</p>
  
  <pre><code>&lt;ListView x:Name="MyList"&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;TextBlock FontWeight="Bold" Text="{Binding Name}"/&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.ItemTemplate&gt;
          &lt;DataTemplate DataType="{x:Type testProgram:MyClass}"&gt;
              &lt;TextBlock Text="{Binding ItemName}"/&gt;
          &lt;/DataTemplate&gt;
      &lt;/ListView.ItemTemplate&gt;
  &lt;/ListView&gt;
  </code></pre>
  
  <p>And here is the code behind:</p>
  
  <pre><code>public partial class MyListView
  {
      public MyListView(ObservableCollection&lt;MyClass&gt; items)
      {
          InitializeComponent();
          Items = items;
  
          var v = CollectionViewSource.GetDefaultView(Items);
          v.GroupDescriptions.Add(new PropertyGroupDescription("GroupName"));
          MyList.ItemsSource = v;
      }
  
      public ObservableCollection&lt;MyClass&gt; Items { get; set; }
  }
  </code></pre>
  
  <p>When I remove the <code>&lt;ListView.GroupStyle&gt;...</code> and set <code>MyList.ItemsSource = Items;</code> then everything shows up properly.
  I suspect that the issue is between <code>ItemsSource = v</code>, <code>DataType = "{x:Type testProgram:MyClass}"</code>, and <code>{Binding ItemName}</code>, but I don't know what is breaking or how to fix it.</p>