public IMaybe <object> GetValue(IDependencyProperty dp)
 {
     if (HasValue(dp))
     {
         return(Maybe.FromValue(parent.GetValue(dp)));
     }
     return(Maybe.None <object>());
 }
        public void OnInheritanceParentChanged(IDependencyComponent oldParent, IDependencyComponent newParent)
        {
            var allSetProperties = new HashSet <IDependencyProperty>();

            if (oldParent != null)
            {
                oldParent.PropertyChanged -= OnParentPropertyChanged;

                foreach (var dp in oldParent.SetProperties)
                {
                    if (Component.GetMetadata(dp).IsInherited)
                    {
                        allSetProperties.Add(dp);
                    }
                }
            }

            if (newParent != null)
            {
                newParent.PropertyChanged += OnParentPropertyChanged;

                foreach (var dp in newParent.SetProperties)
                {
                    if (Component.GetMetadata(dp).IsInherited)
                    {
                        allSetProperties.Add(dp);
                    }
                }
            }

            foreach (var dp in allSetProperties)
            {
                var oldValue = oldParent != null
                    ? Maybe.FromValue(oldParent.GetValue(dp))
                    : Maybe.None <object>();

                var newValue = newParent != null
                    ? Maybe.FromValue(newParent.GetValue(dp))
                    : Maybe.None <object>();

                if (Helpers.AreDifferent(oldValue, newValue))
                {
                    ValueChanged?.Invoke(this, new ValueChangedEventArgs(Component, dp, oldValue, newValue));
                }
            }
        }