internal void Show(LayoutAnchorControl anchor) { if (_model != null) { throw new InvalidOperationException(); } _anchor = anchor; _model = anchor.Model as LayoutAnchorable; var layoutAnchorSide = anchor.Model.Parent.Parent as LayoutAnchorSide; if (layoutAnchorSide != null) { _side = layoutAnchorSide.Side; } if (_model != null) { _manager = _model.Root.Manager; CreateInternalGrid(); _model.PropertyChanged += _model_PropertyChanged; } Visibility = Visibility.Visible; InvalidateMeasure(); UpdateLayout(); Trace.WriteLine("LayoutAutoHideWindowControl.Show()"); }
internal void Show(LayoutAnchorControl anchor) { if (!(anchor.Model.Parent.Parent is LayoutAnchorSide)) { //var root = Root; if (anchor.Model is LayoutAnchorable && anchor.Model.Parent is LayoutRoot) { var model = anchor.Model as LayoutAnchorable; var root = anchor.Model.Parent as LayoutRoot; var newAnchorGroup = new LayoutAnchorGroup(); newAnchorGroup.Children.Add(model); AnchorSide anchorSide = LayoutSetting.GetDefaultSideAnchorable(model.Title); switch (anchorSide) { case AnchorSide.Right: root.RightSide.Children.Add(newAnchorGroup); break; case AnchorSide.Left: root.LeftSide.Children.Add(newAnchorGroup); break; case AnchorSide.Top: root.TopSide.Children.Add(newAnchorGroup); break; case AnchorSide.Bottom: root.BottomSide.Children.Add(newAnchorGroup); break; } } else { return; } } if (_model != null) { throw new InvalidOperationException(); } _anchor = anchor; _model = anchor.Model as LayoutAnchorable; _side = (anchor.Model.Parent.Parent as LayoutAnchorSide).Side; _manager = _model.Root.Manager; CreateInternalGrid(); _model.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(_model_PropertyChanged); Visibility = System.Windows.Visibility.Visible; InvalidateMeasure(); UpdateWindowPos(); Trace.WriteLine("LayoutAutoHideWindowControl.Show()"); }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { AnchorSide anchorSide = (AnchorSide)value; if (anchorSide != AnchorSide.Left && anchorSide != AnchorSide.Right) { return(Orientation.Horizontal); } return(Orientation.Vertical); }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { AnchorSide anchorSide = (AnchorSide)value; if (anchorSide != AnchorSide.Left && anchorSide != AnchorSide.Right) { return(Binding.DoNothing); } return(90); }
/// <summary> /// Converts an <see cref="AnchorSide"/> value into a floating point value that /// indicates whether the content should be rotated by 90.0 degrees or not. /// /// Returns Binding.DoNothing if not rotation is required. /// </summary> /// <param name="value">The value produced by the binding source.</param> /// <param name="targetType">The type of the binding target property.</param> /// <param name="parameter">The converter parameter to use.</param> /// <param name="culture">The culture to use in the converter.</param> /// <returns>A converted value.</returns> public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { AnchorSide side = (AnchorSide)value; if (side == AnchorSide.Left || side == AnchorSide.Right) { return(90.0); } return(Binding.DoNothing); }
/// <summary> /// Converts an <see cref="AnchorSide"/> value into a WPF <see cref="Orientation"/> value. /// /// Returns <see cref="Orientation.Vertical"/> for <see cref="AnchorSide.Left"/> or <see cref="AnchorSide.Right"/>, /// othrwise <see cref="Orientation.Horizontal"/> is returned. /// </summary> /// <param name="values">The value produced by the binding source.</param> /// <param name="targetType">The type of the binding target property.</param> /// <param name="parameter">The converter parameter to use.</param> /// <param name="culture">The culture to use in the converter.</param> /// <returns>A converted value.</returns> public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { AnchorSide side = (AnchorSide)value; if (side == AnchorSide.Left || side == AnchorSide.Right) { return(Orientation.Vertical); } return(Orientation.Horizontal); }
private void UpdateSide() { if (Equals(Root.LeftSide, this)) Side = AnchorSide.Left; else if (Equals(Root.TopSide, this)) Side = AnchorSide.Top; else if (Equals(Root.RightSide, this)) Side = AnchorSide.Right; else if (Equals(Root.BottomSide, this)) Side = AnchorSide.Bottom; }
internal LayoutAutoHideWindowControl(LayoutAnchorControl anchor) { _anchor = anchor; _model = anchor.Model as LayoutAnchorable; _side = (anchor.Model.Parent.Parent as LayoutAnchorSide).Side; this.Unloaded += (s, e) => { if (_closeTimer != null) { _closeTimer.Stop(); _closeTimer = null; } _manager.HideAutoHideWindow(_anchor); }; }
internal void Show(LayoutAnchorControl anchor) { if (this._model != null) { throw new InvalidOperationException(); } this._anchor = anchor; this._model = anchor.Model as LayoutAnchorable; this._side = (anchor.Model.Parent.Parent as LayoutAnchorSide).Side; this._manager = this._model.Root.Manager; this.CreateInternalGrid(); this._model.PropertyChanged += new PropertyChangedEventHandler(this._model_PropertyChanged); base.Visibility = System.Windows.Visibility.Visible; base.InvalidateMeasure(); base.UpdateWindowPos(); }
/* * public void RemoveSide() * { * if (Parent is LayoutAnchorGroup) * { * ILayoutRoot root = Root; * LayoutAnchorGroup lagroup = (LayoutAnchorGroup)(Parent); * if (root.RightSide.Children.Contains(lagroup)) * { * root.RightSide.Children.Remove(lagroup); * } * if (root.LeftSide.Children.Contains(lagroup)) * { * root.LeftSide.Children.Remove(lagroup); * } * if (root.TopSide.Children.Contains(lagroup)) * { * root.TopSide.Children.Remove(lagroup); * } * if (root.BottomSide.Children.Contains(lagroup)) * { * root.BottomSide.Children.Remove(lagroup); * } * lagroup.Parent = (ILayoutContainer)(root); * } * } */ public void ReplaceSide(AnchorSide side) { if (Parent is LayoutAnchorGroup) { ILayoutRoot root = Root; LayoutAnchorGroup lagroup = (LayoutAnchorGroup)(Parent); if (root.RightSide.Children.Contains(lagroup)) { root.RightSide.Children.Remove(lagroup); } if (root.LeftSide.Children.Contains(lagroup)) { root.LeftSide.Children.Remove(lagroup); } if (root.TopSide.Children.Contains(lagroup)) { root.TopSide.Children.Remove(lagroup); } if (root.BottomSide.Children.Contains(lagroup)) { root.BottomSide.Children.Remove(lagroup); } switch (side) { case AnchorSide.Right: root.RightSide.Children.Add(lagroup); LayoutSetting.AddDefaultSideAnchorable(Title, "RIGHT"); break; case AnchorSide.Left: root.LeftSide.Children.Add(lagroup); LayoutSetting.AddDefaultSideAnchorable(Title, "LEFT"); break; case AnchorSide.Top: root.TopSide.Children.Add(lagroup); LayoutSetting.AddDefaultSideAnchorable(Title, "TOP"); break; case AnchorSide.Bottom: root.BottomSide.Children.Add(lagroup); LayoutSetting.AddDefaultSideAnchorable(Title, "BOTTOM"); break; } } }
private void UpdateSide() { if (Root.LeftSide == this) { Side = AnchorSide.Left; } else if (Root.TopSide == this) { Side = AnchorSide.Top; } else if (Root.RightSide == this) { Side = AnchorSide.Right; } else if (Root.BottomSide == this) { Side = AnchorSide.Bottom; } }
internal void Show(LayoutAnchorControl anchor) { if (_model != null) { throw new InvalidOperationException(); } _anchor = anchor; _model = anchor.Model as LayoutAnchorable; _side = (anchor.Model.Parent.Parent as LayoutAnchorSide).Side; _manager = _model.Root.Manager; CreateInternalGrid(); _model.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(_model_PropertyChanged); Visibility = System.Windows.Visibility.Visible; InvalidateMeasure(); UpdateWindowPos(); Win32Helper.BringWindowToTop(_internalHwndSource.Handle); }
private void UpdateSide() { if (base.Root.LeftSide == this) { this.Side = AnchorSide.Left; return; } if (base.Root.TopSide == this) { this.Side = AnchorSide.Top; return; } if (base.Root.RightSide == this) { this.Side = AnchorSide.Right; return; } if (base.Root.BottomSide == this) { this.Side = AnchorSide.Bottom; } }
/// <summary> /// Provides a secure method for setting the Side property. /// This dependency property indicates the anchor side of the control. /// </summary> /// <param name="value">The new value for the property.</param> protected void SetSide(AnchorSide value) { SetValue(SidePropertyKey, value); }
internal void Show(LayoutAnchorControl anchor) { if (_model != null) throw new InvalidOperationException(); _anchor = anchor; _model = anchor.Model as LayoutAnchorable; _side = (anchor.Model.Parent.Parent as LayoutAnchorSide).Side; _manager = _model.Root.Manager; CreateInternalGrid(); _model.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(_model_PropertyChanged); Visibility = System.Windows.Visibility.Visible; InvalidateMeasure(); UpdateWindowPos(); Debug.WriteLine("LayoutAutoHideWindowControl.Show()"); }
protected void SetSide(AnchorSide value) { base.SetValue(LayoutAnchorControl.SidePropertyKey, value); }
public void ToggleAutoHide() { #region Anchorable is already auto hidden if (IsAutoHidden) { var parentGroup = Parent as LayoutAnchorGroup; var parentSide = parentGroup.Parent as LayoutAnchorSide; var previousContainer = (( ILayoutPreviousContainer )parentGroup).PreviousContainer as LayoutAnchorablePane; var root = parentGroup.Root as LayoutRoot; if (previousContainer == null) { AnchorSide side = (parentGroup.Parent as LayoutAnchorSide).Side; switch (side) { case AnchorSide.Right: if (parentGroup.Root.RootPanel.Orientation == Orientation.Horizontal) { previousContainer = new LayoutAnchorablePane(); previousContainer.DockMinWidth = this.AutoHideMinWidth; parentGroup.Root.RootPanel.Children.Add(previousContainer); } else { previousContainer = new LayoutAnchorablePane(); LayoutPanel panel = new LayoutPanel() { Orientation = Orientation.Horizontal }; LayoutPanel oldRootPanel = parentGroup.Root.RootPanel as LayoutPanel; root.RootPanel = panel; panel.Children.Add(oldRootPanel); panel.Children.Add(previousContainer); } break; case AnchorSide.Left: if (parentGroup.Root.RootPanel.Orientation == Orientation.Horizontal) { previousContainer = new LayoutAnchorablePane(); previousContainer.DockMinWidth = this.AutoHideMinWidth; parentGroup.Root.RootPanel.Children.Insert(0, previousContainer); } else { previousContainer = new LayoutAnchorablePane(); LayoutPanel panel = new LayoutPanel() { Orientation = Orientation.Horizontal }; LayoutPanel oldRootPanel = parentGroup.Root.RootPanel as LayoutPanel; root.RootPanel = panel; panel.Children.Add(previousContainer); panel.Children.Add(oldRootPanel); } break; case AnchorSide.Top: if (parentGroup.Root.RootPanel.Orientation == Orientation.Vertical) { previousContainer = new LayoutAnchorablePane(); previousContainer.DockMinHeight = this.AutoHideMinHeight; parentGroup.Root.RootPanel.Children.Insert(0, previousContainer); } else { previousContainer = new LayoutAnchorablePane(); LayoutPanel panel = new LayoutPanel() { Orientation = Orientation.Vertical }; LayoutPanel oldRootPanel = parentGroup.Root.RootPanel as LayoutPanel; root.RootPanel = panel; panel.Children.Add(previousContainer); panel.Children.Add(oldRootPanel); } break; case AnchorSide.Bottom: if (parentGroup.Root.RootPanel.Orientation == Orientation.Vertical) { previousContainer = new LayoutAnchorablePane(); previousContainer.DockMinHeight = this.AutoHideMinHeight; parentGroup.Root.RootPanel.Children.Add(previousContainer); } else { previousContainer = new LayoutAnchorablePane(); LayoutPanel panel = new LayoutPanel() { Orientation = Orientation.Vertical }; LayoutPanel oldRootPanel = parentGroup.Root.RootPanel as LayoutPanel; root.RootPanel = panel; panel.Children.Add(oldRootPanel); panel.Children.Add(previousContainer); } break; } } //I'm about to remove parentGroup, redirect any content (ie hidden contents) that point to it //to previousContainer foreach (var cnt in root.Descendents().OfType <ILayoutPreviousContainer>().Where(c => c.PreviousContainer == parentGroup)) { cnt.PreviousContainer = previousContainer; } foreach (var anchorableToToggle in parentGroup.Children.ToArray()) { previousContainer.Children.Add(anchorableToToggle); } if (previousContainer.Children.Count > 0) { // Select the LayoutContent where the Toggle pin button was pressed. previousContainer.SelectedContentIndex = previousContainer.Children.IndexOf(this); } parentSide.Children.Remove(parentGroup); var parent = previousContainer.Parent as LayoutGroupBase; while ((parent != null)) { if (parent is LayoutGroup <ILayoutPanelElement> ) { ((LayoutGroup <ILayoutPanelElement>)parent).ComputeVisibility(); } parent = parent.Parent as LayoutGroupBase; } } #endregion #region Anchorable is docked else if (Parent is LayoutAnchorablePane) { var root = Root; var parentPane = Parent as LayoutAnchorablePane; var newAnchorGroup = new LayoutAnchorGroup(); (( ILayoutPreviousContainer )newAnchorGroup).PreviousContainer = parentPane; foreach (var anchorableToImport in parentPane.Children.ToArray()) { newAnchorGroup.Children.Add(anchorableToImport); } //detect anchor side for the pane var anchorSide = parentPane.GetSide(); switch (anchorSide) { case AnchorSide.Right: if (root.RightSide != null) { root.RightSide.Children.Add(newAnchorGroup); } break; case AnchorSide.Left: if (root.LeftSide != null) { root.LeftSide.Children.Add(newAnchorGroup); } break; case AnchorSide.Top: if (root.TopSide != null) { root.TopSide.Children.Add(newAnchorGroup); } break; case AnchorSide.Bottom: if (root.BottomSide != null) { root.BottomSide.Children.Add(newAnchorGroup); } break; } } #endregion }
public void AddToLayout(DockingManager manager, AnchorableShowStrategy strategy) { if (this.IsVisible || this.IsHidden) { throw new InvalidOperationException(); } bool flag = (strategy & AnchorableShowStrategy.Most) == AnchorableShowStrategy.Most; bool flag1 = (strategy & AnchorableShowStrategy.Left) == AnchorableShowStrategy.Left; bool flag2 = (strategy & AnchorableShowStrategy.Right) == AnchorableShowStrategy.Right; bool flag3 = (strategy & AnchorableShowStrategy.Top) == AnchorableShowStrategy.Top; bool flag4 = (strategy & AnchorableShowStrategy.Bottom) == AnchorableShowStrategy.Bottom; if (!flag) { AnchorSide anchorSide = AnchorSide.Left; if (flag1) { anchorSide = AnchorSide.Left; } if (flag2) { anchorSide = AnchorSide.Right; } if (flag3) { anchorSide = AnchorSide.Top; } if (flag4) { anchorSide = AnchorSide.Bottom; } LayoutAnchorablePane layoutAnchorablePane = manager.Layout.Descendents().OfType <LayoutAnchorablePane>().FirstOrDefault <LayoutAnchorablePane>((LayoutAnchorablePane p) => p.GetSide() == anchorSide); if (layoutAnchorablePane == null) { flag = true; } else { layoutAnchorablePane.Children.Add(this); } } if (flag) { if (manager.Layout.RootPanel == null) { manager.Layout.RootPanel = new LayoutPanel() { Orientation = (flag1 | flag2 ? Orientation.Horizontal : Orientation.Vertical) }; } if (flag1 | flag2) { if (manager.Layout.RootPanel.Orientation == Orientation.Vertical && manager.Layout.RootPanel.ChildrenCount > 1) { manager.Layout.RootPanel = new LayoutPanel(manager.Layout.RootPanel); } manager.Layout.RootPanel.Orientation = Orientation.Horizontal; if (!flag1) { manager.Layout.RootPanel.Children.Add(new LayoutAnchorablePane(this)); return; } manager.Layout.RootPanel.Children.Insert(0, new LayoutAnchorablePane(this)); return; } if (manager.Layout.RootPanel.Orientation == Orientation.Horizontal && manager.Layout.RootPanel.ChildrenCount > 1) { manager.Layout.RootPanel = new LayoutPanel(manager.Layout.RootPanel); } manager.Layout.RootPanel.Orientation = Orientation.Vertical; if (flag3) { manager.Layout.RootPanel.Children.Insert(0, new LayoutAnchorablePane(this)); return; } manager.Layout.RootPanel.Children.Add(new LayoutAnchorablePane(this)); } }
public void ToggleAutoHide() { #region Anchorable is already auto hidden if (IsAutoHidden) { var parentGroup = Parent as LayoutAnchorGroup; var parentSide = parentGroup.Parent as LayoutAnchorSide; var previousContainer = ((ILayoutPreviousContainer)parentGroup).PreviousContainer as LayoutAnchorablePane; if (previousContainer == null) { AnchorSide side = (parentGroup.Parent as LayoutAnchorSide).Side; switch (side) { case AnchorSide.Right: if (parentGroup.Root.RootPanel.Orientation == Orientation.Horizontal) { previousContainer = new LayoutAnchorablePane(); parentGroup.Root.RootPanel.Children.Add(previousContainer); } else { previousContainer = new LayoutAnchorablePane(); LayoutPanel panel = new LayoutPanel() { Orientation = Orientation.Horizontal }; LayoutRoot root = parentGroup.Root as LayoutRoot; LayoutPanel oldRootPanel = parentGroup.Root.RootPanel as LayoutPanel; root.RootPanel = panel; panel.Children.Add(oldRootPanel); panel.Children.Add(previousContainer); } break; case AnchorSide.Left: if (parentGroup.Root.RootPanel.Orientation == Orientation.Horizontal) { previousContainer = new LayoutAnchorablePane(); parentGroup.Root.RootPanel.Children.Insert(0, previousContainer); } else { previousContainer = new LayoutAnchorablePane(); LayoutPanel panel = new LayoutPanel() { Orientation = Orientation.Horizontal }; LayoutRoot root = parentGroup.Root as LayoutRoot; LayoutPanel oldRootPanel = parentGroup.Root.RootPanel as LayoutPanel; root.RootPanel = panel; panel.Children.Add(previousContainer); panel.Children.Add(oldRootPanel); } break; case AnchorSide.Top: if (parentGroup.Root.RootPanel.Orientation == Orientation.Vertical) { previousContainer = new LayoutAnchorablePane(); parentGroup.Root.RootPanel.Children.Insert(0, previousContainer); } else { previousContainer = new LayoutAnchorablePane(); LayoutPanel panel = new LayoutPanel() { Orientation = Orientation.Vertical }; LayoutRoot root = parentGroup.Root as LayoutRoot; LayoutPanel oldRootPanel = parentGroup.Root.RootPanel as LayoutPanel; root.RootPanel = panel; panel.Children.Add(previousContainer); panel.Children.Add(oldRootPanel); } break; case AnchorSide.Bottom: if (parentGroup.Root.RootPanel.Orientation == Orientation.Vertical) { previousContainer = new LayoutAnchorablePane(); parentGroup.Root.RootPanel.Children.Add(previousContainer); } else { previousContainer = new LayoutAnchorablePane(); LayoutPanel panel = new LayoutPanel() { Orientation = Orientation.Vertical }; LayoutRoot root = parentGroup.Root as LayoutRoot; LayoutPanel oldRootPanel = parentGroup.Root.RootPanel as LayoutPanel; root.RootPanel = panel; panel.Children.Add(oldRootPanel); panel.Children.Add(previousContainer); } break; } } else { //I'm about to remove parentGroup, redirect any content (ie hidden contents) that point to it //to previousContainer LayoutRoot root = parentGroup.Root as LayoutRoot; foreach (var cnt in root.Descendents().OfType <ILayoutPreviousContainer>().Where(c => c.PreviousContainer == parentGroup)) { cnt.PreviousContainer = previousContainer; } } foreach (var anchorableToToggle in parentGroup.Children.ToArray()) { previousContainer.Children.Add(anchorableToToggle); } parentSide.Children.Remove(parentGroup); } #endregion #region Anchorable is docked else if (Parent is LayoutAnchorablePane) { var root = Root; var parentPane = Parent as LayoutAnchorablePane; var newAnchorGroup = new LayoutAnchorGroup(); ((ILayoutPreviousContainer)newAnchorGroup).PreviousContainer = parentPane; foreach (var anchorableToImport in parentPane.Children.ToArray()) { newAnchorGroup.Children.Add(anchorableToImport); } //detect anchor side for the pane var anchorSide = parentPane.GetSide(); switch (anchorSide) { case AnchorSide.Right: root.RightSide.Children.Add(newAnchorGroup); break; case AnchorSide.Left: root.LeftSide.Children.Add(newAnchorGroup); break; case AnchorSide.Top: root.TopSide.Children.Add(newAnchorGroup); break; case AnchorSide.Bottom: root.BottomSide.Children.Add(newAnchorGroup); break; } } #endregion }
public void ToggleAutoHide() { #region Anchorable is already auto hidden if (IsAutoHidden) { var parentGroup = Parent as LayoutAnchorGroup; var parentSide = parentGroup.Parent as LayoutAnchorSide; var previousContainer = ((ILayoutPreviousContainer)parentGroup).PreviousContainer as LayoutAnchorablePane; if (previousContainer == null) { AnchorSide side = (parentGroup.Parent as LayoutAnchorSide).Side; switch (side) { case AnchorSide.Right: if (parentGroup.Root.RootPanel.Orientation == Orientation.Horizontal) { previousContainer = new LayoutAnchorablePane(); parentGroup.Root.RootPanel.Children.Add(previousContainer); } else { previousContainer = new LayoutAnchorablePane(); LayoutPanel panel = new LayoutPanel() { Orientation = Orientation.Horizontal }; LayoutRoot root = parentGroup.Root as LayoutRoot; LayoutPanel oldRootPanel = parentGroup.Root.RootPanel as LayoutPanel; root.RootPanel = panel; panel.Children.Add(oldRootPanel); panel.Children.Add(previousContainer); } break; case AnchorSide.Left: if (parentGroup.Root.RootPanel.Orientation == Orientation.Horizontal) { previousContainer = new LayoutAnchorablePane(); parentGroup.Root.RootPanel.Children.Insert(0, previousContainer); } else { previousContainer = new LayoutAnchorablePane(); LayoutPanel panel = new LayoutPanel() { Orientation = Orientation.Horizontal }; LayoutRoot root = parentGroup.Root as LayoutRoot; LayoutPanel oldRootPanel = parentGroup.Root.RootPanel as LayoutPanel; root.RootPanel = panel; panel.Children.Add(previousContainer); panel.Children.Add(oldRootPanel); } break; case AnchorSide.Top: if (parentGroup.Root.RootPanel.Orientation == Orientation.Vertical) { previousContainer = new LayoutAnchorablePane(); parentGroup.Root.RootPanel.Children.Insert(0, previousContainer); } else { previousContainer = new LayoutAnchorablePane(); LayoutPanel panel = new LayoutPanel() { Orientation = Orientation.Vertical }; LayoutRoot root = parentGroup.Root as LayoutRoot; LayoutPanel oldRootPanel = parentGroup.Root.RootPanel as LayoutPanel; root.RootPanel = panel; panel.Children.Add(previousContainer); panel.Children.Add(oldRootPanel); } break; case AnchorSide.Bottom: if (parentGroup.Root.RootPanel.Orientation == Orientation.Vertical) { previousContainer = new LayoutAnchorablePane(); parentGroup.Root.RootPanel.Children.Add(previousContainer); } else { previousContainer = new LayoutAnchorablePane(); LayoutPanel panel = new LayoutPanel() { Orientation = Orientation.Vertical }; LayoutRoot root = parentGroup.Root as LayoutRoot; LayoutPanel oldRootPanel = parentGroup.Root.RootPanel as LayoutPanel; root.RootPanel = panel; panel.Children.Add(oldRootPanel); panel.Children.Add(previousContainer); } break; } // Do something about initializing the docks of previousContainer GridLength[] defaultdock = LayoutSetting.GetDefaultDockAnchorable(Title); previousContainer.DockWidth = defaultdock[0]; previousContainer.DockHeight = defaultdock[1]; } else { //I'm about to remove parentGroup, redirect any content (ie hidden contents) that point to it //to previousContainer LayoutRoot root = parentGroup.Root as LayoutRoot; foreach (var cnt in root.Descendents().OfType <ILayoutPreviousContainer>().Where(c => c.PreviousContainer == parentGroup)) { cnt.PreviousContainer = previousContainer; } } foreach (var anchorableToToggle in parentGroup.Children.ToArray()) { previousContainer.Children.Add(anchorableToToggle); } parentSide.Children.Remove(parentGroup); IsDock = true; } #endregion #region Anchorable is docked else if (Parent is LayoutAnchorablePane) { IsActive = false; IsDock = false; IsFloat = false; var root = Root; var parentPane = Parent as LayoutAnchorablePane; var newAnchorGroup = new LayoutAnchorGroup(); ((ILayoutPreviousContainer)newAnchorGroup).PreviousContainer = parentPane; foreach (var anchorableToImport in parentPane.Children.ToArray()) { newAnchorGroup.Children.Add(anchorableToImport); } //detect anchor side for the pane var anchorSide = parentPane.GetSide(); switch (anchorSide) { case AnchorSide.Right: root.RightSide.Children.Add(newAnchorGroup); LayoutSetting.AddDefaultSideAnchorable(Title, "RIGHT"); break; case AnchorSide.Left: root.LeftSide.Children.Add(newAnchorGroup); LayoutSetting.AddDefaultSideAnchorable(Title, "LEFT"); break; case AnchorSide.Top: root.TopSide.Children.Add(newAnchorGroup); LayoutSetting.AddDefaultSideAnchorable(Title, "TOP"); break; case AnchorSide.Bottom: root.BottomSide.Children.Add(newAnchorGroup); LayoutSetting.AddDefaultSideAnchorable(Title, "BOTTOM"); break; } } #endregion }