ListView for WPF | ComponentOne
Work with ListView / CheckList
In This Topic
    CheckList
    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.

    checklist

    The following code demonstrates how you can display checkboxes against list items.

    public MainWindow()
    {
        InitializeComponent();
        
        for (int i = 1; i < 10; i++)
        {
            listView.Items.Add("Item " + i);
        }
    
        listView.ShowCheckBoxes = true;
    
        cbShowCheckBox.IsChecked = true;
    
        listView.Orientation = Orientation.Vertical;
        
    }
    private void cbShowCheckBox_Click(object sender, System.Windows.RoutedEventArgs e)
    {
        listView.ShowCheckBoxes = cbShowCheckBox.IsChecked == true ? true : false;
    }
    
    private void cbShowSelectAll_Click(object sender, System.Windows.RoutedEventArgs e)
    {
        listView.ShowSelectAll = cbShowSelectAll.IsChecked == true ? true : false;
    }