String property with List of values

3 posts, 0 answers
  1. MaiK
    MaiK avatar
    23 posts
    Member since:
    Mar 2018

    Posted 02 May 2018 Link to this post

    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. Dimitar
    Admin
    Dimitar avatar
    2823 posts

    Posted 03 May 2018 Link to this post

    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.
  3. MaiK
    MaiK avatar
    23 posts
    Member since:
    Mar 2018

    Posted 14 May 2018 Link to this post

    That worked!

     

    Thank you Dimitar :)

Back to Top