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

    ListView supports item selection using check boxes. It allows you to display check boxes for each item in the ListView list and provides users the ability to select items. To display checkboxes against each list item in the ListView control, you can use ShowCheckboxes property of the C1ListView class.

    checkbox selection in ListView

    The following code demonstrates how you can display checkboxes against list items. This example uses the Customer class created in the Quick Start topic.

    Selection.razor
    Copy Code
    @using C1.Blazor.ListView
    
    <C1ListView ItemsSource="countries" T="Country" Style="@("max-height:50vh")" ShowCheckboxes="true"></C1ListView>
    
    @code{
    
        IEnumerable<Country> countries;
    
        protected override void OnInitialized()
        {
            countries = Country.GetCountries();
        }
    }
    

    Furthermore, you can enable multiple selection in the ListView control having checkboxes against each item using the ShowCheckboxes property along with the SelectionMode property. To know more about displaying multiple selection and other selection modes in the ListView control, see Selection Modes topic.