ListBox Control

The ListBox control allows you to select one or more values from a data source.
If the DataType is set as Boolean, it automatically converts the selected value to true.
 
 
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.Web.App.Infrastructure;
using System.Threading;

namespace DataWeb.Web.App.DataWeb.Data.Controls
{
    public class Product_RelatedProducts(Form form, IServiceProvider serviceProvider) :  ListBox(form, serviceProvider)
    {
        private readonly ProductStore productRepository = serviceProvider.GetService<ProductStore>();

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

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