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

Switching Editors

Updated over 6 months ago

When edit operation is about to begin, the EditorRequired event is fired. By using this event, you can replace the default text box editor with one of the four built-in editors that RadCardView provides: ListViewTextBoxEditor, ListViewDropDownListEditor, ListViewSpinEditor, ListViewDateTimeEditor. You can also provide a custom instance as an editor. The default editor used by RadCardView is ListViewTextBoxEditor.

The following example shows how you can change the editor type:

Figure 1: Changed Editors

WinForms RadCardView Changed Editors

Changing Editor Type

C#
private void radCardView1_EditorRequired(object sender, Telerik.WinControls.UI.ListViewItemEditorRequiredEventArgs e)
{
    if (e.ListViewElement.CurrentColumn.FieldName == "TitleOfCourtesy")
    {
        ListViewDropDownListEditor editor = new ListViewDropDownListEditor();
        (editor.EditorElement as BaseDropDownListEditorElement).Items.Add("Ms.");
        (editor.EditorElement as BaseDropDownListEditorElement).Items.Add("Mr.");
        (editor.EditorElement as BaseDropDownListEditorElement).Items.Add("Mrs.");
        e.Editor = editor;
    }
    else if (e.ListViewElement.CurrentColumn.FieldName == "EmployeeID")
    {
        e.EditorType = typeof(ListViewSpinEditor);
    }
    else if (e.ListViewElement.CurrentColumn.FieldName == "BirthDate" || e.ListViewElement.CurrentColumn.FieldName == "HireDate")
    {
        e.EditorType = typeof(ListViewDateTimeEditor);
    }
    else
    {
        e.EditorType = typeof(ListViewTextBoxEditor);
    }
}

See Also

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