I am using a checkbox on expander. I want, when I check that checkbox ,it will select all rows of list view those开发者_运维知识库 are coming under that expander.
set the listview's selectionmode
to Multiple' or 'Extended
and
on the CheckBox_Checked event you can write the code to select the rows of listview
private void CheckBox_Checked(object sender, RoutedEventArgs e)
{
listview1.SelectAll();
}
Try this inside your checkbox_click events handler:
listView1.BeginUpdate();
foreach (ListViewItem i in listView1.Items)
{
i.Selected = true;
}
listView1.EndUpdate();
Which gives you a bit more flexibility.
精彩评论