private void DockingManager_OnActiveContentChanged(object sender, EventArgs e) { DocumentView document = DockingManager.ActiveContent as DocumentView; DocumentViewModel documentViewModel = document?.DataContext as DocumentViewModel; if (documentViewModel != null) { _viewModel.ActiveDocument = documentViewModel; } }
private void Document_Closing(object sender, System.ComponentModel.CancelEventArgs e) { var result = MessageBox.Show(this, "Do you want to save before exit?", "Close document", MessageBoxButton.YesNoCancel); if (result == MessageBoxResult.Cancel) { e.Cancel = true; } else { GraphDocument document = sender as GraphDocument; DocumentView view = document.Content as DocumentView; _viewModel.RemoveDocument(view.DataContext as DocumentViewModel); document.Closing -= Document_Closing; } }
private void PoolView_Loaded(object sender, RoutedEventArgs e) { _documentView = VisualHelper.FindParent <DocumentView>(this); }