$99 VS $1000+. UI Control for ASP.NET AJAX(contains chart and gridview).
PropertyGrid WinForms Control
Easily process properties of data objects, automatically generate and display custom data in C#.
Home > WinForms UI Controls > User Manual > Handle Events to PropertyGrid Editors in C#

Editor Events of PropertyGrid .NET Component

KetticPropertyGrid WinForms control allows you embed a number of data editors into individual cells for editing and better data presentation. This .NET UI component is able to control the process of editing, including the initialization, editors for validating and events value changing. There are also advanced data editing options available with the Property Grid Control. For instance, by using this control, the users can perform a specific operation based on the user input in the editor as it is opened by handling the events of the editors.

Handling Editor Events of PropertyGrid in C#.NET

In the example below, we are going to set specific text in the PropertyGrid editor. We should press Ctrl+D and then subscribe to the KeyDown event of the KetticTextBoxElement in the EditorInitialized event handler. It is because that the PropertyGrid editors are reusable, so we must define a field to prevent from subscribing to the KeyDown once again.
C# code for handling the events of PropertyGrid editors

public PropertyGridHandlingEditorsEvents()
{
InitializeComponent();

this.ketticPropertyGrid1.EditorInitialized += new PropertyGridItemEditorInitializedEventHandler(ketticPropertyGrid1_EditorInitialized);
}

bool tbSubscribed = false;

void ketticPropertyGrid1_EditorInitialized(object sender, PropertyGridItemEditorInitializedEventArgs e)
{
PropertyGridTextBoxEditor editor = e.Editor as PropertyGridTextBoxEditor;

if (editor != null)
{
if (!tbSubscribed)
{
tbSubscribed = true;
KetticTextBoxElement tbElement = (KetticTextBoxElement)editor.EditorElement;
tbElement.KeyDown += new KeyEventHandler(tbElement_KeyDown);
}
}
}

void tbElement_KeyDown(object sender, KeyEventArgs e)
{
if (e.Control)
{
if (e.KeyCode == Keys.D)
{
((KetticTextBoxElement)sender).Text = "Default setting text";
}
}
}
UI Controlsfor Windows Forms
.NET WinForms UI Overview.NET WinForms UI Features.NET WinForms UI GuideC# WinForms UI DesignVB.NET WinForms UI Design
WinForms UI Controls