title: Customized CollectionViewGroup and ListCollectionView but when add a new item to listbox, it does now work
body: <p>I want to add a new property to <code>CollectionViewGroup</code></p>
  
  <p>So I reference the article:
  <a href="https://stackoverflow.com/questions/37878548/custom-collectionviewtype-does-not-support-multiple-selection-using-shift-key">Custom CollectionViewType does not support multiple selection using shift key</a></p>
  
  <p>when click button to add new item</p>
  
  <pre><code>collection add success(default count=9, add one, total count=10),
  </code></pre>
  
  <p>but <code>listbox</code> does not show the new item group. </p>
  
  <p>maybe something miss to implement.</p>
  
  <p>please help me, or give me the keyword to google. </p>
  
  <p>Thank you.</p>
  
  <p><strong>[Window1.xaml]</strong></p>
  
  <pre><code>&lt;Window.Resources&gt;
      &lt;CollectionViewSource x:Key="EmployeesSource" Source="{Binding Employees}" CollectionViewType="local:EmployeeCollectionView"&gt;
  
          &lt;CollectionViewSource.GroupDescriptions&gt;
              &lt;PropertyGroupDescription PropertyName="HireDate"/&gt;
          &lt;/CollectionViewSource.GroupDescriptions&gt;
  
      &lt;/CollectionViewSource&gt;
  
      &lt;DataTemplate x:Key="EmployeeTemplate"&gt;
          &lt;StackPanel Orientation="Horizontal"&gt;
              &lt;TextBlock Text="{Binding FirstName}" /&gt;
              &lt;TextBlock Text="{Binding LastName}" /&gt;
          &lt;/StackPanel&gt;
      &lt;/DataTemplate&gt;
  &lt;/Window.Resources&gt;
  &lt;Grid&gt;
      &lt;Grid.RowDefinitions&gt;
          &lt;RowDefinition Height="50"/&gt;
          &lt;RowDefinition Height="*"/&gt;
  
      &lt;/Grid.RowDefinitions&gt;
  
      &lt;StackPanel Grid.Row="0"&gt;
          &lt;Button Name="addItem" Width="50" Height="50" Content="AddItem"  HorizontalAlignment="Left" Click="addItem_Click"/&gt;
      &lt;/StackPanel&gt;
  
      &lt;ListBox Grid.Row="1" ItemsSource="{Binding Source={StaticResource EmployeesSource}}"
       ItemTemplate="{StaticResource EmployeeTemplate}"
       SelectionMode="Extended"&gt;
          &lt;ListBox.GroupStyle&gt;
              &lt;x:Static Member="GroupStyle.Default"/&gt;
          &lt;/ListBox.GroupStyle&gt;
      &lt;/ListBox&gt;
  &lt;/Grid&gt;
  </code></pre>
  
  <p></p>
  
  <p><strong>[Window1.xaml.cs]</strong></p>
  
  <pre><code>public partial class Window1 : Window
  {
  
  
      public ObservableCollection&lt;Employee&gt; Employees { get; set; }
  
      public Window1()
      {
          InitializeComponent();
  
  
          Employees = new ObservableCollection&lt;Employee&gt;
          {
              new Employee { FirstName = "FirstName1", LastName = "LastName1", HireDate = new DateTime(1970, 1, 1) },
              new Employee { FirstName = "FirstName2", LastName = "LastName2", HireDate = new DateTime(1970, 1, 1) },
              new Employee { FirstName = "FirstName3", LastName = "LastName3", HireDate = new DateTime(1980, 1, 1) },
              new Employee { FirstName = "FirstName4", LastName = "LastName4", HireDate = new DateTime(1980, 1, 1) },
              new Employee { FirstName = "FirstName5", LastName = "LastName5", HireDate = new DateTime(1980, 1, 1) },
              new Employee { FirstName = "FirstName6", LastName = "LastName6", HireDate = new DateTime(1990, 1, 1) },
              new Employee { FirstName = "FirstName7", LastName = "LastName7", HireDate = new DateTime(1990, 1, 1) },
              new Employee { FirstName = "FirstName8", LastName = "LastName8", HireDate = new DateTime(1990, 1, 1) },
              new Employee { FirstName = "FirstName9", LastName = "LastName9", HireDate = new DateTime(1990, 1, 1) },
          };
          DataContext = this;
      }
  
      private void addItem_Click(object sender, RoutedEventArgs e)
      {
          //Employees add suceess(total count=10), but ui does not add the item(1983,1,1)
          Employees.Add(new Employee {
              FirstName = "FirstName10",
              LastName = "LastName10",
              HireDate = new DateTime(1983, 1, 1)
          });
      }
  }
  
  class EmployeeCollectionView : ListCollectionView
  {
      private readonly IList&lt;EmployeeCollectionViewGroup&gt; _groups;
      public override ReadOnlyObservableCollection&lt;object&gt; Groups
      {
          get { return new ReadOnlyObservableCollection&lt;object&gt;(new ObservableCollection&lt;object&gt;(_groups)); }
      }
  
  
      public EmployeeCollectionView(IList list)
          : base(list)
      {
          _groups = list
               .OfType&lt;Employee&gt;()
              .GroupBy(x =&gt; x.HireDate)
              .Select(x =&gt; new EmployeeCollectionViewGroup(x.Key, x))
              .ToList();
      }
  
  
  }
  
  
  class EmployeeCollectionViewGroup : CollectionViewGroup
  {
      public EmployeeCollectionViewGroup(object name, IEnumerable&lt;object&gt; protectedItems)
          : base(name)
      {
          foreach (var protectedItem in protectedItems)
              ProtectedItems.Add(protectedItem);
      }
  
      public override bool IsBottomLevel
      {
          get { return true; }
      }
  
      //i want to add a new property
      public bool IsDeleting { get; set; } 
  }
  
  
  
  public class Employee : INotifyPropertyChanged
  {
      public event PropertyChangedEventHandler PropertyChanged;
  
  
      private string m_FirstName;
      public string FirstName
      {
          get { return m_FirstName; }
          set
          {
              m_FirstName = value;
              if (PropertyChanged != null)
                  PropertyChanged(this, new PropertyChangedEventArgs("FirstName"));
          }
      }
  
  
  
  
      private string m_LastName;
      public string LastName
      {
          get { return m_LastName; }
          set
          {
              m_LastName = value;
              if (PropertyChanged != null)
                  PropertyChanged(this, new PropertyChangedEventArgs("LastName"));
          }
      }
  
  
  
      private DateTime m_HireDate;
      public DateTime HireDate
      {
          get { return m_HireDate; }
          set
          {
              m_HireDate = value;
              if (PropertyChanged != null)
                  PropertyChanged(this, new PropertyChangedEventArgs("HireDate"));
          }
      }
  
  }
  </code></pre>