Blazor | ComponentOne
Controls / ListView / Selection Modes
In This Topic
    Selection Modes
    In This Topic

    By default, ListView allows you to select a single item from the displayed list. However, you can choose to select a range of items using SelectionMode property of the C1ListView class. The SelectionMode property manages how the items are selected in the ListView control. This property accepts values from the ListViewSelectionMode enumeration which specifies how the section can be performed. It allows you to disable the selection, select a single item or a range of items.

    The following code shows the selection of range of items in the ListView control. This lets you select a range by holding down the Shift key with the left mouse button click simultaneously. This example uses the Customer class created in the Virtualization section.

    Razor
    Copy Code
    @using C1.Blazor.ListView
    
    <C1ListView ItemsSource="@customers" T="Customer" SelectionMode="selectionMode" DisplayMemberPath="Name" />
    
    @code
    {
        IEnumerable<Customer> customers;
        ListViewSelectionMode selectionMode = ListViewSelectionMode.Range;
        
        protected override void OnInitialized()
        {
            customers = Customer.GetCustomerList(100);
        }
    }