PropertyList<T> of a simple POCO class that I want to use a ContentReference or IList<ContentReference> to other content items. The PropertyList works just fine, but when using the dialog to select content for that property, it is not filtering the content tree to just the allowed types specified. Any idea how to get this to work?
Display(Name = "Category", Order = 10)]
[AllowedTypes(typeof(AreaMapCategory.AreaMapCategory))]
public virtual ContentReference Category { get; set; }
And here is the PropertyList definition on my page class:
[Display(
Name = "Area Map Columns",
GroupName = Global.TabNames.AreaMap,
Order = 20)]
[EditorDescriptor(EditorDescriptorType = typeof(CollectionEditorDescriptor<AreaMapColumn>))]
public virtual IList<AreaMapColumn> AreaMapColumns { get; set; }
The second issue comes up when you use a IList<ContentReference> property. When using a IList the same filtering issue happens, but the editor box is wider than the popup editor for the PropertyList item, and there is no way to resize the popup. Also, it mentions that you can drag items onto here, but the background is blocked by the modal popup. The only way to add references is to click the link to add them at the bottom. Any way to improve this experience?
The third issue is how the PropertyList grid displays ContentReference properties. It simply outputs the ID of the content (or comma-delimited list of IDs when using IList) which makes it hard to tell what is selected. I found a forum post on how to get around this by loading the content reference name using a separate property, but it only works when the list first loads. Changing or adding items do not show the name, it leaves the column blank. Is there a better way to do this?
private Injected<IContentLoader> _contentLoader;
[Display(Name = "Category Name", Order = 20)]
[ScaffoldColumn(false)]
public string CategoryNames => Category == null ? "" : _contentLoader.Service.Get<IContent>(Category).Name;