CheckBoxList control

The CheckBoxList control allows selecting one or more values from a data source.
If DataType is set to Boolean, it automatically converts the selected value to true.
We can set a custom data source by specifying the value ControlClass for DataSourceMode and inserting the namespace and class name in the property of the control CustomControlClass.
using System;
using System.Linq;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using DataWeb.Structure;
using DataWeb.Identity;

namespace MyApp.DataWeb.Data.Controls
    public class Control_VisibleRoles : CheckBoxList
        private readonly IUserService userService;

        public Control_VisibleRoles(Form form, IServiceProvider serviceProvider) : base(form, serviceProvider)
            userService = serviceProvider.GetService<IUserService>();

        public override async Task<IEnumerable<List.ListItem>> GetListValuesAsync(Dictionary<string, object> parameters, IUser user, string itemId = null, NavigationContext navigationContext = null)
            var roles = await userService.GetRolesAsync();
            return roles.Select(x => new List.ListItem { Title = x.Name, Value = x.Name });