/// <summary>
        /// Gets all the direct dependencies of a FrameworkElement (based on the set AttachedProperties)
        /// </summary>
        private Dependency[] GetDependencies(UIElement child, IFrameworkElement[] allChildren)
        {
            var dependencies = new List <Dependency>(Dependency.DependencyTypeCount);

            IFrameworkElement element;

            element = GetChild(RelativePanel.GetAbove(child), allChildren);
            if (element != null)
            {
                dependencies.Add(new Dependency(element, DependencyType.Above));
            }

            element = GetChild(RelativePanel.GetBelow(child), allChildren);
            if (element != null)
            {
                dependencies.Add(new Dependency(element, DependencyType.Below));
            }

            element = GetChild(RelativePanel.GetLeftOf(child), allChildren);
            if (element != null)
            {
                dependencies.Add(new Dependency(element, DependencyType.LeftOf));
            }

            element = GetChild(RelativePanel.GetRightOf(child), allChildren);
            if (element != null)
            {
                dependencies.Add(new Dependency(element, DependencyType.RightOf));
            }

            element = GetChild(RelativePanel.GetAlignBottomWith(child), allChildren);
            if (element != null)
            {
                dependencies.Add(new Dependency(element, DependencyType.AlignBottomWith));
            }

            element = GetChild(RelativePanel.GetAlignHorizontalCenterWith(child), allChildren);
            if (element != null)
            {
                dependencies.Add(new Dependency(element, DependencyType.AlignHorizontalCenterWith));
            }

            element = GetChild(RelativePanel.GetAlignLeftWith(child), allChildren);
            if (element != null)
            {
                dependencies.Add(new Dependency(element, DependencyType.AlignLeftWith));
            }

            element = GetChild(RelativePanel.GetAlignRightWith(child), allChildren);
            if (element != null)
            {
                dependencies.Add(new Dependency(element, DependencyType.AlignRightWith));
            }

            element = GetChild(RelativePanel.GetAlignTopWith(child), allChildren);
            if (element != null)
            {
                dependencies.Add(new Dependency(element, DependencyType.AlignTopWith));
            }

            element = GetChild(RelativePanel.GetAlignVerticalCenterWith(child), allChildren);
            if (element != null)
            {
                dependencies.Add(new Dependency(element, DependencyType.AlignVerticalCenterWith));
            }

            return(dependencies.ToArray());
        }