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 IsViewContainedInDocumentGroupContainer(object parameter) { View view = parameter as View; if (view != null) { DocumentGroup documentGroup = view.Parent as DocumentGroup; if (documentGroup != null) { return(documentGroup.Parent is DocumentGroupContainer); } } return(false); }
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); } }