Telerik UI for Windows Phone by Progress

A Generic List Editor can be set to any type of property. Its purpose is to define a limited set of values that can be set to that property. A Generic List editor uses a RadListPicker to allow you to select between the predefined values.

Defining a Generic List Editor for a property

To define a Generic List Editor for a given property you should use the GenericListEditor attribute and provide an implementation of the IGenericListEditorInfoProvider interface. A generic list editor gets its values set via this interface. Suppose we have a City property which is of type string and want to define a limited amount of selectable values for it. The code snippet below demonstrates how to achieve this:

CopyC#
[GenericListEditor(typeof(CityGenericListInfoProvider))]
public string City
{
    get
    {
        return city;
    }
    set
    {
        city = value;
    }
}

public class CityGenericListInfoProvider : IGenericListFieldInfoProvider
{

    public System.Collections.IEnumerable ItemsSource
    {
        get { return new string[] { "Sofia", "Berlin", "Boston", "New York" }; }
    }

    public IGenericListValueConverter ValueConverter
    {
        get { return null; }
    }
}

This will create an editor field using the RadListPicker control which will be populated with the values returned in the IEnumerable provided by the IGenericListFieldInfoProvider implementation:

Data Form Generic List Editor
Data Form Generic List Editor 1