title: How do GroupStyles work?
body: <p>I have a ListView Control bound to a <code>ListCollectionView</code> in a ViewModel.</p>
  
  <p>I wanted to try to group these items but having some problems.</p>
  
  <p>I set the Property grouping in the VM to begin with and then added a <code>GroupStyle</code>.</p>
  
  <p>C#:</p>
  
  <pre><code>ListCollectionView.GroupDescriptions.Add(new PropertyGroupDescription("Category"));
  </code></pre>
  
  <p>XAML:</p>
  
  <pre><code>&lt;ListView.GroupStyle&gt;
      &lt;GroupStyle&gt;
          &lt;GroupStyle.HeaderTemplate&gt;
              &lt;DataTemplate&gt;
                   &lt;TextBlock Text="{Binding Path=Name}"/&gt;
              &lt;/DataTemplate&gt;
          &lt;/GroupStyle.HeaderTemplate&gt;
      &lt;/GroupStyle&gt;
  &lt;/ListView.GroupStyle&gt;
  </code></pre>
  
  <p>However the list is now just the category names, no way to see the items themselves.</p>
  
  <p>I'm not really understanding completely what is going on here. When I create a Template for the <code>GroupStyle</code> what am I really binding to? Are there other properties besides <code>Name</code> ?</p>
  
  <p>I just added the <code>GroupStyle</code> to a ListView I has already created where I for example included a <code>ItemTemplate</code>. Is that something that is messing with the <code>GroupStyle</code>?</p>
  
  <p>What if the Items in the list belong to another class and I wan't to group based on what instance of class they belong to (it has an ID). I would then have the group name as a property on this parent class. Is that possible?</p>
  
  <p><strong>PARTIAL SOLUTION:</strong></p>
  
  <p>Problem was with the style applied on the ListView. I have no idea what about the style was interefering.</p>
  
  <p><strong>FULL SOLUTION</strong></p>
  
  <p>I wasn't using a <code>ItemsPresenter</code> in my listbox <code>ControlTemplate</code> opting to use a Panel with <code>IsItemsHost</code> set to <code>true</code>. It seems ItemsPresenter must be used for GroupStyling to work correctly.</p>