Selector.Selected Selector.Selected Selector.Selected Attached Event

Definición

Se produce cuando se selecciona un elemento.Occurs when an item is selected.

see AddSelectedHandler, and RemoveSelectedHandler
see AddSelectedHandler, and RemoveSelectedHandler
see AddSelectedHandler, and RemoveSelectedHandler

Ejemplos

Los ejemplos siguientes muestran cómo usar el Selected eventos con un ListBox control.The following examples show how to use the Selected event with a ListBox control. El primer ejemplo genera el evento y la segunda muestra cómo controlar el evento.The first example raises the event and the second shows how to handle the event.

<ListBoxItem Name="lbi0" Selected="OnSelected" Unselected="OnUnselected">
     Item 0</ListBoxItem>
private void OnSelected(object sender, RoutedEventArgs e)
{
    Item.Content = ((ListBoxItem)sender).Name + " was selected.";
}
Private Sub OnSelected(ByVal sender As Object, ByVal e As RoutedEventArgs)
	Item.Content = (CType(sender, ListBoxItem)).Name & " was selected."
End Sub

Comentarios

Información sobre eventos enrutadosRouted Event Information

Campo de identificadorIdentifier field SelectedEvent
Estrategia de enrutamientoRouting strategy PropagaciónBubbling
delegadoDelegate RoutedEventHandler

Se aplica a