Exemple #1
0
        static void SetStronglyRecommendedDefaults(ILayoutElement element)
        {
            //Debug.Write(element);

            LayoutContent content = element as LayoutContent;

            if (content == null)
            {
                //Debug.Write(" not");
            }
            else
            {
                SetLayoutContentDefaults(content);

                // subclasses of LayoutContent
                LayoutAnchorable anchorable = content as LayoutAnchorable;
                if (anchorable != null)
                {
                    SetLayoutAnchorableDefaults(anchorable);
                }
            }

            //Debug.WriteLine(" a LayoutContent");

            //Debug.Indent();
            foreach (ILayoutElement desc in element.Descendents())
            {
                SetStronglyRecommendedDefaults(desc);
            }
            //Debug.Unindent();
        }
Exemple #2
0
        public static AnchorSide GetSide(this ILayoutElement element)
        {
            AnchorSide             anchorSide;
            ILayoutOrientableGroup parent = element.Parent as ILayoutOrientableGroup;

            if (parent != null)
            {
                if (!parent.ContainsChildOfType <LayoutDocumentPaneGroup, LayoutDocumentPane>())
                {
                    return(parent.GetSide());
                }
                using (IEnumerator <ILayoutElement> enumerator = parent.Children.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        ILayoutElement current = enumerator.Current;
                        if (current == element || current.Descendents().Contains(element))
                        {
                            anchorSide = (parent.Orientation == Orientation.Horizontal ? AnchorSide.Left : AnchorSide.Top);
                            return(anchorSide);
                        }
                        else
                        {
                            ILayoutContainer layoutContainer = current as ILayoutContainer;
                            if (layoutContainer == null || !layoutContainer.IsOfType <LayoutDocumentPane, LayoutDocumentPaneGroup>() && !layoutContainer.ContainsChildOfType <LayoutDocumentPane, LayoutDocumentPaneGroup>())
                            {
                                continue;
                            }
                            anchorSide = (parent.Orientation == Orientation.Horizontal ? AnchorSide.Right : AnchorSide.Bottom);
                            return(anchorSide);
                        }
                    }
                    return(AnchorSide.Right);
                }
                return(anchorSide);
            }
            return(AnchorSide.Right);
        }
Exemple #3
0
 public static IEnumerable <LayoutAnchorablePane> LayoutAnchorablePanes(this ILayoutElement element, string name)
 {
     return(element.Descendents()
            .OfType <LayoutAnchorablePane>()
            .Where(x => x.Name == name));
 }
Exemple #4
0
 public static IEnumerable <LayoutAnchorable> LayoutAnchorables(this ILayoutElement element, string contentId)
 {
     return(element.Descendents()
            .OfType <LayoutAnchorable>()
            .Where(x => x.ContentId == contentId));
 }
Exemple #5
0
 public static IEnumerable <LayoutAnchorable> LayoutAnchorables(this ILayoutElement element, object content)
 {
     return(element.Descendents()
            .OfType <LayoutAnchorable>()
            .Where(x => x.Content == content));
 }
Exemple #6
0
 public static IEnumerable <LayoutAnchorablePane> LayoutAnchorablePanes(this ILayoutElement element)
 {
     return(element.Descendents()
            .OfType <LayoutAnchorablePane>());
 }
Exemple #7
0
 public static T FirstDescendent <T>(this ILayoutElement element) where T : class, ILayoutElement
 {
     return(element.Descendents <T>().FirstOrDefault());
 }