AI OnAI Off
If I understand the question correctly...
Have you tried using your own model/DTO in the property list, rather than a string -- with a SelectionFactory?
Example...
public class SomePage : PageData { [EditorDescriptor(EditorDescriptorType = typeof(CollectionEditorDescriptor<SomeStringsModel>))] public virtual IList<string> SomeStrings { get; set; } } [PropertyDefinitionTypePlugIn] public class SomeStringsPropertyList : PropertyList<SomeStringsModel> { public override PropertyData ParseToObject(string value) { this.ParseToSelf(value); return this; } protected override SomeStringsModel ParseItem(string value) { return JsonConvert.DeserializeObject<SomeStringsModel>(value); } } public class SomeStringsModel { [SelectOne(SelectionFactoryType = typeof(SomeStringSelectionFactory))] public virtual string SomeString { get; set; } } public class SomeStringSelectionFactory : ISelectionFactory { public IEnumerable<ISelectItem> GetSelections(ExtendedMetadata metadata) { // return your selections here return new[] {"Selection 1", "Selection 2"}.Select(x => new SelectItem { Text = x, Value = x }); } }
I have an Episerver 11.3.1 site. I'm building a block that needs to store a list of strings, so I thougt this would be a perfect scenario for using the new property value list described here: https://world.episerver.com/blogs/bartosz-sekula/dates/2017/10/property-value-list/
The problem is, I want each item in the list to be selected from a dropdown. Essentially, I want to apply the [SelectOne] attribute to each individual item in the list.
Here's what I tried. I created an editor descriptor for my property:
I did the following in the ModifyMetadata method override:
I came up with that by comparing the json for two different properties (one a simple string with a SelectOne attribute, the other an IList) coming back from the server after this ajax call: /EPiServer/shell/Stores/metadata/EPiServer.Core.ContentData?modelAccessor=%7B%22contentLink%22%3A%22950_986%22%7D&dojo.preventCache=1516984334772
The list functionality works with this, but none of the items in the list have any sort of control - textbox, dropdown, or otherwise.
Is this even possible? I'd appreciate some help -- or if someone knows it definitively is not possible, I'd like to log it as a feature request. :)