Property Value List lets editors input multiple primitive values.
The available and supported types are:
The idea is the same as with the `
List<T>`, you add the list as a new property to your model, and the default descriptors match `
IList` type and render the correct editor.
The property type does not have to be `
IList`. The Optimizely descriptors are configured to match the `
IList` interface but they also cover all base ones, so if you prefer to use `
IEnumerable` or `
ICollection` you can do so. All the following declarations are matched by the Value List descriptor.
You can apply validation to both the list itself and to the individual items, and you can use `
ListItemsAttribute` to control the number of items in the list:
The attributes that can be applied to individual items are:
## Render a list
To render a list:
To use the `
PropertyFor` helper method you must define a specific Display template, and to do that you must first attach a `
UIHint` to your property:
Then add a _StringsCollection.cshtml_ file to the _~/Views/Shared/DisplayTemplates_ folder.
An example of a Display Template can be seen in the Alloy package:
Add a `
UniqueSellingPoints` property to your page template:
And you will see the following result in on-page edit: