New to Telerik UI for WPFStart a free 30-day trial

Override the ShowEditorCommand of RadPropertyGrid

Updated on Sep 15, 2025

Environment

Product Version2022.2.621
ProductRadPropertyGrid for WPF

Description

How to replace the show editor command, executed when the modal editor of the PropertyGrid is used. The modal editor is used when the EditorAttribute is used with EditorType set to Modal.

Solution

To replace the default action executed on modal editor button click, override the behavior of the Telerik's ModalEditor.ShowEditorCommand.

C#
	static MainWindow()
	{
		CommandManager.RegisterClassCommandBinding(typeof(RadButton), new CommandBinding(ModalEditor.ShowEditorCommand, ShowEditorExecuted, CanShowEditorExecute));
	}

	private static void CanShowEditorExecute(object sender, CanExecuteRoutedEventArgs e)
	{
		e.CanExecute = true;
		e.Handled = true;
	}

	private static void ShowEditorExecuted(object sender, ExecutedRoutedEventArgs e)
	{
		var button = (RadButton)sender;
		var modalEditor = button.ParentOfType<ModalEditor>();
		if (modalEditor != null)
		{
			// here you can execute a custom action, like opening of custom dialog
			var window = new Window()
			{
				DataContext = modalEditor.DataContext,
				Content = modalEditor.Editor,
				SizeToContent = SizeToContent.WidthAndHeight,
				Owner = Application.Current.MainWindow,
				WindowStartupLocation = modalEditor.WindowStartupLocation,
				Top = modalEditor.WindowTop,
				Left = modalEditor.WindowLeft
			};
			window.ShowDialog();
		}
	}
In this article
EnvironmentDescriptionSolution
Not finding the help you need?
Contact Support