ListBox.SelectedItems Property


Gets the currently selected items.

Namespace:   System.Windows.Controls
Assembly:  PresentationFramework (in PresentationFramework.dll)

Public ReadOnly Property SelectedItems As IList

Property Value

Type: System.Collections.IList

Returns a collection of the currently selected items.

Exception Condition

The SelectionMode property is set to Single.

This property is meant to be used when SelectionMode does not equal Single. If the selection mode is Single the correct property to use is SelectedItem.

Identifier field


Metadata properties set to true


The following example shows how to use the SelectedItems property to determine whether a list box has any selected items.

Private Sub SelectedItems(ByVal sender As Object, ByVal e As RoutedEventArgs)
	If lb.SelectedItem IsNot Nothing Then
		label1.Content = "Has " & (lb.SelectedItems.Count.ToString()) & " item(s) selected."
	End If
End Sub

.NET Framework
Available since 3.0
Available since 3.0
Windows Phone Silverlight
Available since 7.0
Return to top