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

适用于

另请参阅