void OnWorkspaceRequestClose(object sender, EventArgs e) { WorkspaceVmBase workspace = sender as WorkspaceVmBase; workspace.Dispose(); this.MainTabs.Remove(workspace); }
public virtual void SetActiveWorkspace(WorkspaceVmBase workspace) { //Debug.Assert(this.MainTabs.Contains(workspace)); //ICollectionView collectionView = CollectionViewSource.GetDefaultView(this.MainTabs); //if (collectionView == null) return; //var found = collectionView.MoveCurrentTo(workspace); if (!MainTabs.MakeCurrent(workspace)) { Warn_n($"{GetType().Name} : MainWindowVMBase.SetActiveWorkspace()", $"Workspace not found: “{workspace}”"); } }
public void ShowTogether(WorkspaceVmBase naviVm , WorkspaceVmBase mainVm , WorkspaceVmBase othrVm) { if (naviVm != null) { naviVm.IsSelectedChanged += (s, e) => { if (e.Value) { MainTabs?.MakeCurrent(mainVm); OtherTabs?.MakeCurrent(othrVm); } }; } if (mainVm != null) { mainVm.IsSelectedChanged += (s, e) => { if (e.Value) { NaviTabs?.MakeCurrent(naviVm); OtherTabs?.MakeCurrent(othrVm); } }; } if (othrVm != null) { othrVm.IsSelectedChanged += (s, e) => { if (e.Value) { NaviTabs?.MakeCurrent(naviVm); MainTabs?.MakeCurrent(mainVm); } }; } }