title: ListView group headers binding issue
body: <p>I have a basic program in which I'm trying to test a possible layout of <code>ListView</code>, so that I can use it in my main project.  I'm having a problem displaying the headers for the groups and I can't figure it out.  It's obviously a binding issue, but after much searching and reading through many <code>ListView</code> grouping/header related postings, I haven't been able to solve it.  I prefer to get it all done within XAML, since my ViewModels will have no knowledge of the Views.  I can display regular text, but not the binding when dealing with the group headers.  Here's my code:</p>
  
  <p><strong>View:</strong>
      
          
      </p>
  
  <pre><code>&lt;Window.Resources&gt;
      &lt;CollectionViewSource Source="{Binding Collection}" x:Key="GroupedItems"&gt;
          &lt;CollectionViewSource.GroupDescriptions&gt;
              &lt;PropertyGroupDescription PropertyName="RepNum" /&gt;
          &lt;/CollectionViewSource.GroupDescriptions&gt;
      &lt;/CollectionViewSource&gt;
  &lt;/Window.Resources&gt;
  
  &lt;ListView HorizontalAlignment="Left" Height="300" Margin="10,10,0,0" 
            VerticalAlignment="Top" Width="497"
            ItemsSource="{Binding Source={StaticResource GroupedItems}}"&gt;
      &lt;ListView.View&gt;
          &lt;GridView&gt;
              &lt;GridViewColumn Header="File Name" 
                              DisplayMemberBinding="{Binding FileName}"/&gt;
              &lt;GridViewColumn Header="Date Scanned" 
                              DisplayMemberBinding="{Binding DateScanned}"/&gt;
              &lt;GridViewColumn Header="Time Scanned" 
                              DisplayMemberBinding="{Binding TimeScanned}"/&gt;
          &lt;/GridView&gt;
      &lt;/ListView.View&gt;
  
      &lt;ListView.GroupStyle&gt;
          &lt;GroupStyle&gt;
              &lt;GroupStyle.HeaderTemplate&gt;
                  &lt;DataTemplate&gt;
                      &lt;StackPanel Orientation="Horizontal"&gt;
                          &lt;TextBlock Text="{Binding RepNum}" Margin="0,0,10,0"/&gt;
                          &lt;TextBlock Text="Text1" Margin="0,0,10,0"/&gt;
                          &lt;TextBlock Text="Text2"/&gt;
                      &lt;/StackPanel&gt;
                  &lt;/DataTemplate&gt;
              &lt;/GroupStyle.HeaderTemplate&gt;
          &lt;/GroupStyle&gt;
      &lt;/ListView.GroupStyle&gt;
  &lt;/ListView&gt;
  </code></pre>
  
  <p><strong>ViewModel (very dirty, quick-style for testing purposes):</strong></p>
  
  <pre><code>public class MainWindowViewModel
  {
      public ObservableCollection&lt;Record&gt; Collection { get; set; }
  
      public MainWindowViewModel()
      {
          Collection = new ObservableCollection&lt;Record&gt;();
  
          Collection.Add(
              new Record()
              {
                  RepNum = "12345",
                  FileName = "12345.pdf",
                  DateScanned = "05/01/2014",
                  TimeScanned = "1802"
              });
  
          Collection.Add(
              new Record()
              {
                  RepNum = "12345",
                  FileName = "12345C1.pdf",
                  DateScanned = "05/03/2014",
                  TimeScanned = "1401"
              });
  
          Collection.Add(
              new Record()
              {
                  RepNum = "12345",
                  FileName = "12345S1.pdf",
                  DateScanned = "05/03/2014",
                  TimeScanned = "1408"
              });
  
          Collection.Add(
              new Record()
              {
                  RepNum = "643334",
                  FileName = "643334.pdf",
                  DateScanned = "02/01/2013",
                  TimeScanned = "1305"
              });
  
          Collection.Add(
              new Record()
              {
                  RepNum = "643334",
                  FileName = "643334S1.pdf",
                  DateScanned = "02/06/2013",
                  TimeScanned = "0805"
              });
      }
  }
  </code></pre>
  
  <p>You can guess what Record class looks like by looking at how I create instances of it, so there's nothing special there.  I don't have a problem viewing RepNum on any binding, except the <code>ListView</code> group header.  I'm obviously either missing a step or don't have a proper binding syntax for its case.  However, I can't figure it out.</p>
  
  <p>Here's what it looks like:</p>
  
  <p><img src="https://i.stack.imgur.com/3AHyG.png" alt="enter image description here"></p>
  
  <p>As you can see, plain text "Text1" and "Text2" are displayed, but not the <code>RepNum</code> property.</p>
  
  <p>I tried:</p>
  
  <pre><code>Text="{Binding Source={StaticResource GroupedItems}, Path=RepNum}"
  </code></pre>
  
  <p>...but that displays <code>RepNum</code> of the first group for every header:</p>
  
  <p><img src="https://i.stack.imgur.com/eWnHX.png" alt="enter image description here"></p>