RadioButtonList Control

The RadioButtonList control allows you to select a value from a data source.
 
 
Personalization
We can set up a custom data source by specifying the ControlClass value for DataSourceMode and putting namespace and class name in the CustomControlClass control's property. 
 
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Linq;
using Microsoft.Extensions.DependencyInjection;
using DataWeb.Structure;
using DataWeb.Identity;
using DataWeb.Data;
using DataWeb.Data.Controls;
using DataWeb.WebApp.Infrastructure;
using Microsoft.Extensions.Localization;

namespace MyApp.DataWeb.Data.Controls
{
    public class Category_AreaName :  RadioButtonList
    {
        private readonly AreaStore areaStore;
        private readonly IStringLocalizer localizer;

        public Category_AreaName(Form form, IServiceProvider serviceProvider) : base(form, serviceProvider)
        {
            areaStore = serviceProvider.GetService<AreaStore>();
            localizer = serviceProvider.GetService<IStringLocalizer>();
        }

        public override async Task<IEnumerable<List.ListItem>> GetListValuesAsync(Dictionary<string, object> parameters, IUser user, string itemId = null, NavigationContext navigationContext = null, CancellationToken cancellationToken = default)
        {
            var areas = await areaStore.GetAreasAsync(new AreaRepository.Filter(), "en-US");

            return areas.Select(x => new List.ListItem { Title = x.Name, Value = x.Name });
        }
    }
}