共用方式為


TreeViewItem.Unselected 事件

定義

IsSelectedTreeViewItem 屬性從 true 變更為 false 時發生。

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

事件類型

範例

下列範例示範如何將 事件的事件處理常式 Selected 指派給 TreeViewItem ,以及如何定義事件處理常式。

<TreeViewItem Header="Employee2" 
              Name="Employee2Data">
  <TreeViewItem Header="Work Days" 
                Name="emp2WorkDays" 
                Selected="GetSchedule"
                Unselected="SetSchedule">
    <TreeViewItem Header="Monday" />
    <TreeViewItem Header="Wednesday"/>
  </TreeViewItem>
private void SetSchedule(object sender, RoutedEventArgs e)
{
    //Perform actions when a TreeViewItem
    //control becomes unselected
}
Private Sub SetSchedule(ByVal sender As Object, ByVal e As RoutedEventArgs)
    'Perform actions when a TreeViewItem
    'control becomes unselected
End Sub

備註

當選取範圍從這個 TreeViewItem 變更為控制項中的另一個 TreeViewItemTreeView 時,就會發生此事件。 此事件與 SelectedItemChanged 控制項的 屬性 TreeView 有變更 SelectedItem 時所發生的事件相關。

路由事件資訊

識別碼欄位 UnselectedEvent
路由策略 鼓 泡
代理人 RoutedEventHandler

適用於

另請參閱