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

Customizing Editor Behavior

Updated over 1 year ago

The appearance and behavior of property grid editors can be changed programmatically. This can be done in the EditorInitialized event. EditorInitialized is fired when the editor is created and initialized with a predefined set of properties.

Figure 1: Customize Editor

WinForms RadPropertyGrid Customize Editor

The following sample demonstrates how to change the default font of PropertyGridTextBoxEditor:

Customize editor

C#
void radPropertyGrid1_EditorInitialized(object sender, Telerik.WinControls.UI.PropertyGridItemEditorInitializedEventArgs e)
{
    PropertyGridTextBoxEditor editor = e.Editor as PropertyGridTextBoxEditor;

    if (editor != null)
    {
        ((RadTextBoxElement)editor.EditorElement).Font = new Font(FontFamily.Families[12], 10, FontStyle.Bold);
    }

}

PropertyGridSpinEditor null values support.

The following snippet shows how you can enable the null values support in the spin editor:

C#
void radPropertyGrid_EditorInitialized(object sender, Telerik.WinControls.UI.PropertyGridItemEditorInitializedEventArgs e)
{
    PropertyGridSpinEditor editor = e.Editor as PropertyGridSpinEditor;
    if (editor != null)
    {
        BaseSpinEditorElement el = editor.EditorElement as BaseSpinEditorElement;
        el.EnableNullValueInput = true;
    }
}

See Also

In this article
See Also
Not finding the help you need?
Contact Support