title: Grouping listview
body: <p>Below is the code currently I am using for grouping in <code>listview</code>. I am able to group records, but when user clicks on the <code>button(AddNewCluster)</code> to create new group with set of records I am unable to concatenate with the old records. The <code>listview</code> gets updated  with the new group and records. But I need to show the user both the old and newly added group and records.</p>
  
  <pre><code>ListCollectionView collectionView;  
  
  public Window1() 
  {
      InitializeComponent();
  
      var clusters = new[] 
      {
          new Cluster { Name = "Front end" }, 
          new Cluster { Name = "Middle end" }, 
          new Cluster { Name = "Back end" }, 
      };    
      collectionView = new ListCollectionView(new[] 
      {
          new Server { Cluster = clusters[0], Name = "webshop1" }, 
          new Server { Cluster = clusters[0], Name = "webshop2" }, 
          new Server { Cluster = clusters[0], Name = "webshop3" }, 
          new Server { Cluster = clusters[0], Name = "webshop4" }, 
          new Server { Cluster = clusters[0], Name = "webshop5" }, 
          new Server { Cluster = clusters[0], Name = "webshop6" }, 
          new Server { Cluster = clusters[2], Name = "sql1" }, 
          new Server { Cluster = clusters[2], Name = "sql2" }, 
      });
  
      var groupDescription = new PropertyGroupDescription("Cluster.Name"); 
      // this foreach must at least add clusters that can't be  
      // derived from items - i.e. groups with no items in them  
      foreach (var cluster in clusters) 
      groupDescription.GroupNames.Add(cluster.Name);    
      collectionView.GroupDescriptions.Add(groupDescription);
      ServersList.ItemsSource = collectionView;    
      Clusters = groupDescription.GroupNames;
  }
  readonly ObservableCollection&lt;object&gt; Clusters; 
  </code></pre>
  
  <p>And here is the <code>AddNewCluster_Click</code> method:</p>
  
  <pre><code>void AddNewCluster_Click(object sender, RoutedEventArgs e) 
  {
      Clusters.Add(NewClusterName.Text);
  
      var clusters = new[] 
      {
          new Cluster { Name = NewClusterName.Text }, 
      };
  
      collectionView = new ListCollectionView(new[] 
      {
          new Server { Name = "new server data" }, 
      });
  
      var groupDescription = new PropertyGroupDescription("Cluster.Name");  
  
      // this foreach must at least add clusters that can't be 
  
      // derived from items - i.e. groups with no items in them 
  
      foreach (var cluster in clusters) 
          groupDescription.GroupNames.Add(cluster.Name);
  
      collectionView.GroupDescriptions.Add(groupDescription);
  
      ServersList.ItemsSource = collectionView;
  
  }
  </code></pre>