private void UnHookNotifyChildPropertyChangedHandler(NotifyChildPropertyChangedEventHandlerDescriptor handlerDescriptor)
        {
            object currentValue = handlerDescriptor.Reference.Target;

            if (currentValue != null)
            {
                NotifyPropertyChangedAccessor.RemoveChildPropertyChangedHandler(currentValue, handlerDescriptor.Handler);
            }
        }
        private void HookNotifyChildPropertyChangedHandler(object instance, string locationName)
        {
            object currentValue = instance as INotifyPropertyChanged;

            if (currentValue != null &&
                instrumentedTypes.GetOrAdd(currentValue.GetType(), type => type.IsDefined(typeof(NotifyPropertyChangedAttribute), true)))
            {
                string locationNameClosure = locationName;
                NotifyChildPropertyChangedEventHandlerDescriptor handlerDescriptor = new NotifyChildPropertyChangedEventHandlerDescriptor(
                    currentValue, (_, a) => this.NotifyChildPropertyChangedEventHandler(locationNameClosure, a));
                this.notifyChildPropertyChangedHandlers.AddOrUpdate(locationNameClosure, handlerDescriptor);
                NotifyPropertyChangedAccessor.AddChildPropertyChangedHandler(currentValue, handlerDescriptor.Handler);
            }
        }
 private void UnHookNotifyChildPropertyChangedHandler( NotifyChildPropertyChangedEventHandlerDescriptor handlerDescriptor )
 {
     object currentValue = handlerDescriptor.Reference.Target;
     if ( currentValue != null )
     {
         NotifyPropertyChangedAccessor.RemoveChildPropertyChangedHandler( currentValue, handlerDescriptor.Handler );
     }
 }
 private void HookNotifyChildPropertyChangedHandler( object instance, string locationName )
 {
     object currentValue = instance as INotifyPropertyChanged;
     if (currentValue != null &&
         instrumentedTypes.GetOrAdd(currentValue.GetType(), type => type.IsDefined(typeof(NotifyPropertyChangedAttribute), true)))
     {
         string locationNameClosure = locationName;
         NotifyChildPropertyChangedEventHandlerDescriptor handlerDescriptor = new NotifyChildPropertyChangedEventHandlerDescriptor(
             currentValue, ( _, a ) => this.NotifyChildPropertyChangedEventHandler( locationNameClosure, a ) );
         this.notifyChildPropertyChangedHandlers.AddOrUpdate( locationNameClosure, handlerDescriptor );
         NotifyPropertyChangedAccessor.AddChildPropertyChangedHandler( currentValue, handlerDescriptor.Handler );
     }
 }