void ActiveViews_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { if (e.Action == NotifyCollectionChangedAction.Add) { //are we dealing with a view FrameworkElement frameworkElement = e.NewItems[0] as FrameworkElement; if (frameworkElement != null) { ContentPane contentPane = frameworkElement as ContentPane; if (contentPane == null) { contentPane = frameworkElement.Parent as ContentPane; } if (contentPane != null && !contentPane.IsActivePane) { contentPane.Activate(); } } else { //must be a viewmodel object viewModel = e.NewItems[0]; var contentPane = GetContentPaneFromFromViewModel(viewModel); if (contentPane != null) { contentPane.Activate(); } } } }
public void ShowDocumentWindow(object viewModel, object context = null, bool selectWhenShown = true) { ContentPane dockableWindow = CreateDockable(viewModel, context); TabGroupPane host = XamDockManagerHelper.FindTabGroupPane(GetDockingManager()); host.Items.Add(dockableWindow); if (selectWhenShown) { dockableWindow.Activate(); } }
public void ShowFloatingWindow(object viewModel, object context = null, bool selectWhenShown = true) { ContentPane dockableWindow = CreateDockable(viewModel, context); SplitPane pane = new SplitPane(); XamDockManager.SetInitialLocation(pane, InitialPaneLocation.DockableFloating); pane.Panes.Add(dockableWindow); DockManager.Panes.Add(pane); if (selectWhenShown) { dockableWindow.Activate(); } }
public void ShowDockedWindow(object viewModel, object context = null, bool selectWhenShown = true, InitialPaneLocation dockstate = InitialPaneLocation.DockedLeft) { ContentPane dockableWindow = CreateDockable(viewModel, context); SplitPane pane = XamDockManagerHelper.FindSplitPaneWithLocationOrCreate(GetDockingManager(_window), dockstate); pane.Panes.Add(dockableWindow); //If this is a new dockable location (there are no split panes for it) //we need to add it to the XamDockManager if (pane.Parent == null) { DockManager.Panes.Add(pane); } if (selectWhenShown) { dockableWindow.Activate(); } }