ListBoxItem.Unselected ListBoxItem.Unselected ListBoxItem.Unselected ListBoxItem.Unselected Event

Definition

Tritt ein, wenn die Auswahl eines ListBoxItem aufgehoben wird.Occurs when a ListBoxItem is unselected.

public:
 event System::Windows::RoutedEventHandler ^ Unselected;
public event System.Windows.RoutedEventHandler Unselected;
member this.Unselected : System.Windows.RoutedEventHandler 
Public Custom Event Unselected As RoutedEventHandler 

Beispiele

In den folgenden Beispielen wird gezeigt, wie Sie dieses Ereignis abonnieren und behandeln.The following examples show how to subscribe to and handle this event.

<ListBoxItem Name="lbi0" Selected="OnSelected" Unselected="OnUnselected">Item 0</ListBoxItem>
private void OnUnselected(object sender, RoutedEventArgs e)
{
    ListBoxItem lbi = e.Source as ListBoxItem;

    if (lbi != null)
    {
        label1.Content = lbi.Content.ToString() + " is unselected.";
    }
}
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

Hinweise

Wenn Sie wissen möchten, wann die ListBox Auswahl in einer geändert wird SelectionChanged , lauschen Sie auf das-Ereignis.To know when the selection in a ListBox changes, listen for the SelectionChanged event.

Informationen zum RoutingereignisRouted Event Information

BezeichnerfeldIdentifier field UnselectedEvent
Routing StrategieRouting strategy BlasenBubbling
delegateDelegate RoutedEventHandler

Gilt für: