private void OuterDock(DockEventArgs e) { var groups = e.SourceContent.OfType <TabWellModelBase>().ToList(); var newGroup = new ToolWellModel() { Dock = (Dock)((int)e.TargetDock - 5) }; foreach (var group in groups) { var allChildren = group.Children.ToList(); foreach (var item in allChildren) { group.Children.Remove(item); item.IsPinned = false; item.IsActive = false; newGroup.Children.Add(item); } } var newSplit = new SplitPanelModel(); newSplit.Orientation = e.TargetDock == DockTarget.DockLeft || e.TargetDock == DockTarget.DockRight ? Orientation.Horizontal : Orientation.Vertical; if (ParentBranch == null) { ParentContainer.Content = newSplit; } else { ParentBranch.Replace(this, newSplit); } if (e.TargetDock == DockTarget.DockTop || e.TargetDock == DockTarget.DockLeft) { newSplit.Item1 = newGroup; newSplit.Item2 = this; newSplit.Item1.PanelSize = new GridLength(e.DesiredSize); } else { newSplit.Item1 = this; newSplit.Item2 = newGroup; newSplit.Item2.PanelSize = new GridLength(e.DesiredSize); } newGroup.IsActive = true; newGroup.SelectedItem = newGroup.Children.First(); e.SourceWindow.Close(); }
private void OnItemChanged(TabOwnerModelBase prev, TabOwnerModelBase next) { prev?.SetParent(null); next?.SetParent(this); if (next == null) { var remaining = Item1 ?? Item2; if (remaining == null) { return; } Item1 = Item2 = null; if (ParentBranch != null) { ParentBranch.Replace(this, remaining); } else if (ParentContainer != null) { ParentContainer.Content = remaining; } } }
protected override void DockExecuted(DockEventArgs e) { if (e.TargetDock == DockTarget.Center) { base.DockExecuted(e); return; } var groups = e.SourceContent.OfType <TabWellModelBase>().ToList(); var newGroup = new ToolWellModel() { Dock = Dock }; foreach (var group in groups) { var allChildren = group.Children.ToList(); foreach (var item in allChildren) { group.Children.Remove(item); item.IsPinned = false; item.IsActive = false; newGroup.Children.Add(item); } } var newSplit = new SplitPanelModel(); double remainingSize; if (e.TargetDock == DockTarget.SplitLeft || e.TargetDock == DockTarget.SplitRight) { newSplit.Orientation = Orientation.Horizontal; remainingSize = Width - e.DesiredSize; } else { newSplit.Orientation = Orientation.Vertical; remainingSize = Height - e.DesiredSize; } ParentBranch.Replace(this, newSplit); if (e.TargetDock == DockTarget.SplitTop || e.TargetDock == DockTarget.SplitLeft) { newSplit.Item1 = newGroup; newSplit.Item2 = this; newSplit.Item1.PanelSize = new GridLength(e.DesiredSize, GridUnitType.Star); newSplit.Item2.PanelSize = new GridLength(remainingSize, GridUnitType.Star); } else { newSplit.Item1 = this; newSplit.Item2 = newGroup; newSplit.Item1.PanelSize = new GridLength(remainingSize, GridUnitType.Star); newSplit.Item2.PanelSize = new GridLength(e.DesiredSize, GridUnitType.Star); } newGroup.IsActive = true; newGroup.SelectedItem = newGroup.Children.First(); e.SourceWindow.Close(); }