BetterExplorer.PieChart.Legend.DataContextChangedHandler C# (CSharp) Method

DataContextChangedHandler() private method

Handle changes in the datacontext. When a change occurs handlers are registered for events which occur when the collection changes or any items within teh collection change.
private DataContextChangedHandler ( object sender, System.Windows.DependencyPropertyChangedEventArgs e ) : void
sender object
e System.Windows.DependencyPropertyChangedEventArgs
return void
        private void DataContextChangedHandler(object sender, DependencyPropertyChangedEventArgs e)
        {
            // handle the events that occur when the bound collection changes
            if (this.DataContext is INotifyCollectionChanged)
            {
                INotifyCollectionChanged observable = (INotifyCollectionChanged)this.DataContext;
                observable.CollectionChanged += new NotifyCollectionChangedEventHandler(BoundCollectionChanged);
            }

            ObserveBoundCollectionChanges();
        }