public void Initialize(ViewElement view) { this.sibling = DraggedTabInfo.FindFirstSibling(view); ViewGroup parent = view.Parent; this.nestedGroup = (ViewElement)null; this.groupPosition = -1; this.groupFloatingHeight = 0.0; this.groupFloatingWidth = 0.0; this.groupContainer = (DocumentGroupContainer)null; if (parent == null) { return; } if (parent.Parent != null) { this.groupPosition = parent.Parent.Children.IndexOf((ViewElement)parent); if (parent != null && parent.Children.Count == 1 && parent.Parent.Children.Count == 1) { this.nestedGroup = (ViewElement)parent; } } this.groupDockedWidth = parent.DockedWidth; this.groupDockedHeight = parent.DockedHeight; this.groupFloatingWidth = parent.FloatingWidth; this.groupFloatingHeight = parent.FloatingHeight; this.groupContainer = parent.Parent as DocumentGroupContainer; }
private void CreateDocumentGroup(ViewElement view, Orientation orientation) { if (view == null) { throw new ArgumentNullException("view"); } DocumentGroup documentGroup1 = view.Parent as DocumentGroup; if (documentGroup1 == null) { throw new InvalidOperationException("View that is being moved must be child of a DocumentGroup."); } DocumentGroupContainer documentGroupContainer = documentGroup1.Parent as DocumentGroupContainer; if (documentGroupContainer == null) { throw new InvalidOperationException("DocumentGroup must be child of a DocumentGroupContainer"); } DocumentGroup documentGroup2 = DocumentGroup.Create(); documentGroup2.FloatingHeight = 200.0; documentGroup2.FloatingWidth = 300.0; documentGroup2.IsVisible = true; documentGroup1.Children.Remove(view); documentGroup2.Children.Add(view); if (documentGroupContainer.VisibleChildren.Count <= 1) { documentGroupContainer.Orientation = orientation; } int num = documentGroupContainer.Children.IndexOf((ViewElement)documentGroup1); documentGroupContainer.Children.Insert(num + 1, (ViewElement)documentGroup2); documentGroup2.SelectedElement = view; }
private void MoveToTabGroup(ViewElement view, int tabGroupOffset) { DocumentGroup documentGroup1 = view.Parent as DocumentGroup; if (documentGroup1 == null) { throw new InvalidOperationException("View that is being moved must be child of a DocumentGroup."); } DocumentGroupContainer documentGroupContainer = documentGroup1.Parent as DocumentGroupContainer; if (documentGroupContainer == null) { throw new InvalidOperationException("DocumentGroup must be child of a DocumentGroupContainer"); } List <ViewElement> list = new List <ViewElement>(documentGroupContainer.FindAll((Predicate <ViewElement>)(v => v is DocumentGroup))); int num = list.IndexOf((ViewElement)documentGroup1); if (num + tabGroupOffset < 0 || num + tabGroupOffset >= list.Count) { return; } DocumentGroup documentGroup2 = list[num + tabGroupOffset] as DocumentGroup; view.Detach(); DockOperations.Dock((ViewElement)documentGroup2, view, DockDirection.Fill); documentGroup2.SelectedElement = view; }
private bool ValidateElement(DocumentGroupContainer container) { bool flag = true; if (container.Children.Count == 0) { container.Children.Add((ViewElement)DocumentGroup.Create()); } return(flag); }
private bool ValidateElement(ViewElement element) { if (!this.IsFiniteSizeInValidRange(element.MinimumHeight)) { element.MinimumHeight = (double)ViewElement.MinimumHeightProperty.DefaultMetadata.DefaultValue; } if (!this.IsFiniteSizeInValidRange(element.MinimumWidth)) { element.MinimumWidth = (double)ViewElement.MinimumWidthProperty.DefaultMetadata.DefaultValue; } if (!this.IsFiniteSizeInValidRange(element.AutoHideHeight)) { element.AutoHideHeight = (double)ViewElement.AutoHideHeightProperty.DefaultMetadata.DefaultValue; } if (!this.IsFiniteSizeInValidRange(element.AutoHideWidth)) { element.AutoHideWidth = (double)ViewElement.AutoHideWidthProperty.DefaultMetadata.DefaultValue; } if (!this.IsFiniteSizeInValidRange(element.FloatingHeight)) { element.FloatingHeight = (double)ViewElement.FloatingHeightProperty.DefaultMetadata.DefaultValue; } if (!this.IsFiniteSizeInValidRange(element.FloatingWidth)) { element.FloatingWidth = (double)ViewElement.FloatingWidthProperty.DefaultMetadata.DefaultValue; } if (!this.IsValueInValidRange(element.FloatingLeft, double.NegativeInfinity, double.PositiveInfinity, false, false)) { element.FloatingLeft = (double)ViewElement.FloatingLeftProperty.DefaultMetadata.DefaultValue; } if (!this.IsValueInValidRange(element.FloatingTop, double.NegativeInfinity, double.PositiveInfinity, false, false)) { element.FloatingTop = (double)ViewElement.FloatingTopProperty.DefaultMetadata.DefaultValue; } MainSite site1 = element as MainSite; if (site1 != null) { return(this.ValidateElement(site1)); } FloatSite site2 = element as FloatSite; if (site2 != null) { return(this.ValidateElement(site2)); } DocumentGroupContainer container = element as DocumentGroupContainer; if (container != null) { return(this.ValidateElement(container)); } return(true); }
internal static ViewElement CreateDefaultMainSiteContent() { AutoHideChannel autoHideChannel1 = AutoHideChannel.Create(); autoHideChannel1.Dock = Dock.Left; autoHideChannel1.Orientation = Orientation.Vertical; AutoHideChannel autoHideChannel2 = AutoHideChannel.Create(); autoHideChannel2.Dock = Dock.Right; autoHideChannel2.Orientation = Orientation.Vertical; AutoHideChannel autoHideChannel3 = AutoHideChannel.Create(); autoHideChannel3.Dock = Dock.Top; autoHideChannel3.Orientation = Orientation.Horizontal; AutoHideChannel autoHideChannel4 = AutoHideChannel.Create(); autoHideChannel4.Dock = Dock.Bottom; autoHideChannel4.Orientation = Orientation.Horizontal; DocumentGroupContainer documentGroupContainer = DocumentGroupContainer.Create(); documentGroupContainer.DockedWidth = new SplitterLength(1.0, SplitterUnitType.Fill); documentGroupContainer.DockedHeight = new SplitterLength(1.0, SplitterUnitType.Fill); documentGroupContainer.Children.Add((ViewElement)DocumentGroup.Create()); DockRoot dockRoot = DockRoot.Create(); dockRoot.DockedWidth = new SplitterLength(1.0, SplitterUnitType.Fill); dockRoot.DockedHeight = new SplitterLength(1.0, SplitterUnitType.Fill); dockRoot.Children.Add((ViewElement)documentGroupContainer); AutoHideRoot autoHideRoot = AutoHideRoot.Create(); autoHideRoot.DockedWidth = new SplitterLength(1.0, SplitterUnitType.Fill); autoHideRoot.DockedHeight = new SplitterLength(1.0, SplitterUnitType.Fill); autoHideRoot.Children.Add((ViewElement)autoHideChannel1); autoHideRoot.Children.Add((ViewElement)autoHideChannel2); autoHideRoot.Children.Add((ViewElement)autoHideChannel3); autoHideRoot.Children.Add((ViewElement)autoHideChannel4); autoHideRoot.Children.Add((ViewElement)dockRoot); return((ViewElement)autoHideRoot); }
private void OnFloatingElementDocked(object sender, FloatingElementDockedEventArgs args) { if (args.Content == null) { return; } DockTarget dockTarget = (DockTarget)sender; if (args.CreateDocumentGroup) { DocumentGroup documentGroup = dockTarget.DataContext as DocumentGroup; DocumentGroupContainer container = dockTarget.DataContext as DocumentGroupContainer; if (documentGroup == null) { documentGroup = container.Children[0] as DocumentGroup; } if (container == null) { container = documentGroup.Parent as DocumentGroupContainer; } Orientation orientation = container.Orientation; int position = container.Children.IndexOf((ViewElement)documentGroup); switch (args.DockDirection) { case DockDirection.FirstValue: orientation = Orientation.Vertical; break; case DockDirection.Bottom: orientation = Orientation.Vertical; ++position; break; case DockDirection.Left: orientation = Orientation.Horizontal; break; case DockDirection.Right: orientation = Orientation.Horizontal; ++position; break; } container.Orientation = orientation; ViewElement viewElement = container.Children[0]; DockOperations.Dock((ViewElement)DockOperations.CreateDocumentGroupAt(container, position), args.Content, DockDirection.Fill); } else if (dockTarget.DockTargetType == DockTargetType.Inside || dockTarget.DockTargetType == DockTargetType.CenterOnly || (dockTarget.DockTargetType == DockTargetType.SidesOnly || dockTarget.DockTargetType == DockTargetType.FillPreview)) { ViewElement targetView = dockTarget.DataContext as ViewElement; DocumentGroup documentGroup = targetView as DocumentGroup; if (documentGroup != null && args.DockDirection != DockDirection.Fill) { targetView = (ViewElement)documentGroup.Parent; } DockOperations.Dock(targetView, args.Content, args.DockDirection); } else { DockOperations.DockOutside(dockTarget.DataContext as ViewGroup, args.Content, args.DockDirection); } }