ListBoxItem.Unselected 活動
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
當 a ListBoxItem 未被選取時發生。
public:
event System::Windows::RoutedEventHandler ^ Unselected;
public event System.Windows.RoutedEventHandler Unselected;
member this.Unselected : System.Windows.RoutedEventHandler
Public Custom Event Unselected As RoutedEventHandler
事件類型
範例
以下範例說明如何訂閱並處理此事件。
<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
備註
要知道選擇何時ListBox改變,請聆聽事件。SelectionChanged
路由事件資訊
| Item | 價值觀 |
|---|---|
| 識別碼欄位 | UnselectedEvent |
| 路由策略 | 氣泡 |
| 代理人 | RoutedEventHandler |