Bagikan melalui


ListBoxItem.Unselected Kejadian

Definisi

Terjadi ketika tidak ListBoxItem dipilih.

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

Jenis Acara

Contoh

Contoh berikut menunjukkan cara berlangganan dan menangani kejadian ini.

<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

Keterangan

Untuk mengetahui kapan pilihan dalam perubahan ListBox , dengarkan peristiwa tersebut SelectionChanged .

Informasi Peristiwa Yang Dirutekan

Bidang pengidentifikasi UnselectedEvent
Strategi perutean Menggelegak
Delegasikan RoutedEventHandler

Berlaku untuk