A class that helps listening to changes on the Parent property of FrameworkElement objects.
Inheritance: System.Windows.DependencyObject, IDisposable
        /// <summary>
        /// Register the parent notifier.
        /// Call the constructor of this class to register.
        /// Otherwise register in your own implementation by calling this function.
        /// </summary>
        protected void RegisterParentNotifier()
        {
            parentChangedNotifier = new ParentChangedNotifier(this, () =>
            {
                var targetObject = this.Parent;
                if (targetObject != null)
                {
                    var targetObjectType = targetObject.GetType();
                    var properties       = targetObjectType.GetProperties();

                    foreach (var p in properties)
                    {
                        if (p.GetValue(targetObject, null) == this)
                        {
                            var info = new TargetInfo(targetObject, p, p.PropertyType, -1);
                            SetPropertyValue(ProvideValue(new SimpleProvideValueServiceProvider(info)), info, false);
                        }
                    }
                }
            });
        }
        private void RegisterParentNotifier()
        {
            parentChangedNotifier = new ParentChangedNotifier(this, () =>
            {
                parentChangedNotifier.Dispose();
                parentChangedNotifier = null;
                var targetObject = this.Parent;
                if (targetObject != null)
                {
                    var properties = GetDependencyProperties(targetObject);
                    foreach (var p in properties)
                    {
                        if (targetObject.GetValue(p) == this)
                        {
                            targetInfo = new TargetInfo(targetObject, p, p.PropertyType, -1);

                            Binding binding = new Binding("Content");
                            binding.Source = this;
                            binding.Converter = this.Converter;
                            binding.ConverterParameter = this.ConverterParameter;
                            binding.Mode = BindingMode.OneWay;
                            BindingOperations.SetBinding(targetObject, p, binding);
                            UpdateNewValue();
                        }
                    }
                }
            });
        } 
 /// <summary>
 /// Adds the key-value-pair.
 /// </summary>
 /// <param name="target">The target key object.</param>
 /// <param name="parentChangedNotifier">The notifier.</param>
 public void Add(DependencyObject target, ParentChangedNotifier parentChangedNotifier)
 {
     _inner.Add(new TypedWeakReference<DependencyObject>(target), new TypedWeakReference<ParentChangedNotifier>(parentChangedNotifier));
 }