ListBoxItem.Unselected Event

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Occurs when a ListBoxItem is unselected.

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

Public Event Unselected As RoutedEventHandler

To know when the selection in a ListBox changes, listen for the SelectionChanged event.

Identifier field

UnselectedEvent

Routing strategy

Bubbling

Delegate

RoutedEventHandler

The following examples show how to subscribe to and handle this event.

<ListBoxItem Name="lbi0" Selected="OnSelected" Unselected="OnUnselected">Item 0</ListBoxItem>
Private Sub OnUnselected(ByVal sender As Object, ByVal e As RoutedEventArgs)
	Dim lbi As ListBoxItem = TryCast(e.Source, ListBoxItem)

	If lbi IsNot Nothing Then
		label1.Content = lbi.Content.ToString() & " is unselected."
	End If
End Sub

.NET Framework
Available since 3.0
Return to top
Show: