ListBoxItem.Unselected Evento

Definición

Se produce cuando se anula la selección de ListBoxItem.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 

Tipo de evento

RoutedEventHandler

Ejemplos

En los siguientes ejemplos se muestra cómo suscribirse a este evento y controlarlo.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

Comentarios

Para saber cuándo cambia la selección en un ListBox , escuche el SelectionChanged evento.To know when the selection in a ListBox changes, listen for the SelectionChanged event.

Información sobre eventos enrutadosRouted Event Information

Campo de identificadorIdentifier field UnselectedEvent
Estrategia de enrutamientoRouting strategy PropagaciónBubbling
DelegadoDelegate RoutedEventHandler

Se aplica a