This is a migrated thread and some comments may be shown as answers.

String property with List of values

2 Answers 124 Views
PropertyGrid
This is a migrated thread and some comments may be shown as answers.
MaiK
Top achievements
Rank 1
Iron
MaiK asked on 02 May 2018, 03:21 PM

Hi,

I have bind an object to property grid. One of the objects properties is String but I want that property must fill with values of a list.

How can I make it?

 

Regards!

2 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 03 May 2018, 11:21 AM
Hi Mikel,

You can use the EditorRequired event to change the editor when needed. Here is an example:
private void RadPropertyGrid1_EditorRequired(object sender, Telerik.WinControls.UI.PropertyGridEditorRequiredEventArgs e)
{
    if (e.Item.Name == "Text")
    {
        var editor = new PropertyGridDropDownListEditor();
        var element = editor.EditorElement as BaseDropDownListEditorElement;
        element.DataSource = new List<string>() { "Item1", "Item2" };
        e.Editor = editor;
    }
}

Detailed information is available in the following section: Editors | RadPropertyGrid.

I hope this will be useful.

Regards,
Dimitar
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
MaiK
Top achievements
Rank 1
Iron
answered on 14 May 2018, 03:56 PM

That worked!

 

Thank you Dimitar :)

Tags
PropertyGrid
Asked by
MaiK
Top achievements
Rank 1
Iron
Answers by
Dimitar
Telerik team
MaiK
Top achievements
Rank 1
Iron
Share this question
or