Ntreev.Library.PsdViewer.ViewModels.TreeViewItemViewModel.childrens_CollectionChanged C# (CSharp) Method

childrens_CollectionChanged() private method

private childrens_CollectionChanged ( object sender, System e ) : void
sender object
e System
return void
        private void childrens_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
        {
            this.NotifyOfPropertyChange(() => this.Count);

            switch (e.Action)
            {
                case System.Collections.Specialized.NotifyCollectionChangedAction.Add:
                    {
                        foreach (TreeViewItemViewModel item in e.NewItems)
                        {
                            item.parent = this;
                        }
                    }
                    break;
                case System.Collections.Specialized.NotifyCollectionChangedAction.Remove:
                    {
                        foreach (TreeViewItemViewModel item in e.OldItems)
                        {
                            item.parent = null;
                        }
                    }
                    break;
            }
        }