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();
}