New to Telerik UI for WinForms? Start a free 30-day trial
Customizing Editor
Updated over 6 months 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.
The following sample demonstrates how to change the default font of a BaseTextBoxEditor in RadGanttView:
C#
private void GanttViewElement_EditorInitialized(object sender, GanttViewItemEditorInitializedEventArgs e)
{
BaseTextBoxEditor editor = e.Editor as BaseTextBoxEditor;
if (editor != null)
{
((RadTextBoxElement)editor.EditorElement).Font = new Font(FontFamily.Families[12], 12, FontStyle.Bold);
}
}
Mask Editor
The following sample demonstrates how to change the default font of a GanttViewDateTimeEditor in RadGanttView and apply MaskDateTimeProvider with a custom format for time:
C#
private void GanttViewElement_MaskEditorInitialized(object sender, GanttViewItemEditorInitializedEventArgs e)
{
GanttViewDateTimeEditor dtEditor = e.Editor as GanttViewDateTimeEditor;
if (dtEditor != null)
{
dtEditor.CustomFormat = "hh/mm/ss";
MaskDateTimeProvider dtprovider = ((BaseDateTimeEditorElement)dtEditor.EditorElement).TextBoxElement.Provider as MaskDateTimeProvider;
dtprovider.AutoSelectNextPart = true;
}
}