title: WPF ListVIew Grouping name
body: <p>Im very new to WPF and i am working with ListView and Grouping.</p>
  
  <p>What im trying to achieve is to group items by certain type but display a different name on the ListView header. This will allow me to have 2 different group types with the same name</p>
  
  <p>Heres my code so far</p>
  
  <pre><code>   //.....Populate dummy items in a loop
     items.Add(new Beds() { Name = "Bed " + counter, Type = i.ToString() ,  TypeName = "Test Name" });
     //....
  
     lvBeds.ItemsSource = items;
  
     CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(lvBeds.Items);
     PropertyGroupDescription groupDescription = new PropertyGroupDescription("Type");
     view.GroupDescriptions.Add(groupDescription);
  </code></pre>
  
  <p>XAML</p>
  
  <pre><code>   &lt;ListView.GroupStyle&gt;
              &lt;GroupStyle&gt;
                  &lt;GroupStyle.HeaderTemplate&gt;
                      &lt;DataTemplate&gt;
                          &lt;TextBlock FontWeight="Bold" FontSize="20" Text="{Binding TypeName}" Background="Gray" Height="35"/&gt;
                      &lt;/DataTemplate&gt;
                  &lt;/GroupStyle.HeaderTemplate&gt;
              &lt;/GroupStyle&gt;
          &lt;/ListView.GroupStyle&gt;
      &lt;/ListView&gt;
  </code></pre>
  
  <p>I want to map the ListView Header TextBlock Text to "TypeName" while keeping the grouping to "Type". Is that possible?</p>
  
  <blockquote>
    <p><strong>Edit:</strong> I solved this by using IValueConverter to handle the replacement of binding name string.</p>
  </blockquote>
  
  <p><a href="https://stackoverflow.com/questions/17369615/how-to-replace-strings-in-stringformat-in-wpf-binding">How to replace strings in StringFormat in WPF Binding</a></p>