public void AddTool2(TabModel item, Dock targetDock, GridLength defaultSize) { if (item == null) { throw new ArgumentNullException(nameof(item)); } if (item.Usage == TabItemType.Document) { throw new InvalidOperationException(); } var well = AllTabs.Where(t => (t.Parent as ToolWellModel)?.Dock == targetDock) .Select(t => t.Parent as ToolWellModel) .FirstOrDefault(); if (well == null) { well = new ToolWellModel { Dock = targetDock }; var branch = new SplitPanelModel(targetDock, well); well.PanelSize = defaultSize; var temp = content; Content = branch; branch.Add(temp); } well.Children.Add(item); well.SelectedItem = item; well.IsActive = true; }
public void AddTool(TabModel item, TabOwnerModelBase target, Dock dock) { if (item == null) { throw new ArgumentNullException(nameof(item)); } var group = new ToolWellModel() { Width = item.Width, Height = item.Height, Dock = dock }; group.Children.Add(item); var container = new SplitPanelModel(dock, group); if (target == null) { target = Content; Content = container; } else if (target.ParentBranch != null) { target.ParentBranch.Replace(target, container); } else { System.Diagnostics.Debugger.Break(); throw new InvalidOperationException(); } container.Add(target); }