ListBoxItem.Selected ListBoxItem.Selected ListBoxItem.Selected ListBoxItem.Selected Event


ListBoxItem이 선택되면 발생합니다.Occurs when a ListBoxItem is selected.

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


다음 예제에서는 구독 하 고이 이벤트를 처리 하는 방법을 보여 줍니다.The following example shows how to subscribe to and handle this event.

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

    if (lbi != null)
        label1.Content = lbi.Content.ToString() + " is selected.";
Private Sub OnSelected(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 selected."
	End If
End Sub


시기를 알고 선택 항목을 ListBox 변경 내용을 수신 대기를 SelectionChanged 이벤트.To know when the selection in a ListBox changes, listen for the SelectionChanged event.

라우팅 이벤트 정보Routed Event Information

식별자 필드Identifier field SelectedEvent
라우팅 전략Routing strategy 버블링Bubbling
대리자Delegate RoutedEventHandler

적용 대상