Customizing Editor
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:
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);
}
}
Private Sub GanttViewElement_EditorInitialized(sender As Object, e As GanttViewItemEditorInitializedEventArgs)
Dim editor As BaseTextBoxEditor = TryCast(e.Editor, BaseTextBoxEditor)
If editor IsNot Nothing Then
DirectCast(editor.EditorElement, RadTextBoxElement).Font = New Font(FontFamily.Families(12), 12, FontStyle.Bold)
End If
End Sub
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:
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;
}
}
Private Sub GanttViewElement_MaskEditorInitialized(ByVal sender As Object, ByVal e As GanttViewItemEditorInitializedEventArgs)
Dim dtEditor As GanttViewDateTimeEditor = TryCast(e.Editor, GanttViewDateTimeEditor)
If dtEditor IsNot Nothing Then
dtEditor.CustomFormat = "hh/mm/ss"
Dim dtprovider As MaskDateTimeProvider = TryCast((CType(dtEditor.EditorElement, BaseDateTimeEditorElement)).TextBoxElement.Provider, MaskDateTimeProvider)
dtprovider.AutoSelectNextPart = True
End If
End Sub