Calling all developers! We invite you to provide your input on Feature Experimentation by completing this brief survey.
Calling all developers! We invite you to provide your input on Feature Experimentation by completing this brief survey.
Do you need to see the image in edit mode? If not, do something like this?
return HomePage.BannerAlertBackgroundColors?.Select(x => new SelectItem {Text = x.ColorName + ", " + x.Image.Name, Value = x.ColorHexValue + ":" + x.Image.ContentLink.ID });
I had a property list with Name and Value. I made a selection factory to display the names to select one item from the property list. Following that I could get the value of the selected item in the UI. Sample code below..
public IEnumerable<ISelectItem> GetSelections(ExtendedMetadata metadata)
{
if (!_contentLoader.TryGet<HomePage>(ContentReference.StartPage, out var HomePage))
{
return Enumerable.Empty<ISelectItem>();
}
return HomePage.BannerAlertBackgroundColors?.Select(x => new SelectItem {Text = x.ColorName, Value = x.ColorHexValue });
}
This is how I used it in the block:
[SelectOne(SelectionFactoryType = typeof(BannerAlertColorSelectionFactory))]
public virtual string BannerBackgroundColor { get; set; }
I need to expand the property list to add one more item, Ex: Name, Value, Image. But I have to keep the implementation still same. User will be selecting the Name in the CMS. I need to update the selection factory some how to return the entire item so I can access Value and Image both in UI.
Any help is most appreciated.