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(); }
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); }
public static IEnumerable <LayoutAnchorablePane> LayoutAnchorablePanes(this ILayoutElement element, string name) { return(element.Descendents() .OfType <LayoutAnchorablePane>() .Where(x => x.Name == name)); }
public static IEnumerable <LayoutAnchorable> LayoutAnchorables(this ILayoutElement element, string contentId) { return(element.Descendents() .OfType <LayoutAnchorable>() .Where(x => x.ContentId == contentId)); }
public static IEnumerable <LayoutAnchorable> LayoutAnchorables(this ILayoutElement element, object content) { return(element.Descendents() .OfType <LayoutAnchorable>() .Where(x => x.Content == content)); }
public static IEnumerable <LayoutAnchorablePane> LayoutAnchorablePanes(this ILayoutElement element) { return(element.Descendents() .OfType <LayoutAnchorablePane>()); }
public static T FirstDescendent <T>(this ILayoutElement element) where T : class, ILayoutElement { return(element.Descendents <T>().FirstOrDefault()); }