Quantcast
Channel: PowershellTaskForce » Products
Viewing all articles
Browse latest Browse all 12

ListView – Select All

$
0
0

I got a question about select all on a ListView in the comments on the blog and here I will show how to do it.

Select All and Deselect All

I have created a simple ListView with Three items with Checkboxes set to True and two buttons.

2015_ListView_02

The code for Select All:

$buttonSelectAll_Click={
	#TODO: Place custom script here
	foreach ($item in $listview1.Items)
	{
		$item.Checked = $true	
	}
}

2015_ListView_03

And the code for Deselect All:

$buttonDeselectAll_Click={
	#TODO: Place custom script here
	foreach ($item in $listview1.Items)
	{
		$item.Checked = $false
	}
}

2015_ListView_01

Sapien have Three nice posts about the ListView Control:

http://www.sapien.com/blog/2012/04/04/spotlight-on-the-listview-control-part-1/
http://www.sapien.com/blog/2012/04/05/spotlight-on-the-listview-control-part-2/
http://www.sapien.com/blog/2012/04/11/spotlight-on-the-listview-control-part-3/


Viewing all articles
Browse latest Browse all 12

Trending Articles