protected virtual void OnEditorWindowCloseCanExecute(object sender, CanExecuteRoutedEventArgs e) { Window window = (Window)sender; PropertyGridProperty prop = window.DataContext as PropertyGridProperty; if (prop != null) { prop.CanExecute(sender, e); if (e.Handled) { return; } } e.CanExecute = true; }