TreeViewItem.Expanded 事件
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
当 IsExpanded 属性从 false
更改为 true
时发生。
public:
event System::Windows::RoutedEventHandler ^ Expanded;
public event System.Windows.RoutedEventHandler Expanded;
member this.Expanded : System.Windows.RoutedEventHandler
Public Custom Event Expanded As RoutedEventHandler
事件类型
示例
以下示例演示如何将 事件的事件处理程序 Expanded 分配给 , TreeViewItem 以及如何在代码隐藏中定义事件处理程序。
<TreeViewItem Header="Employee1"
Name="Employee1Data"
IsExpanded="True"
Collapsed="OnCollapsed"
Expanded="OnExpanded">
<TreeViewItem Header="Work Days"
Name="EmployeeWorkDays"
IsSelected="True">
<TreeViewItem Header="Tuesday" />
<TreeViewItem Header="Friday"/>
</TreeViewItem>
</TreeViewItem>
<TreeViewItem Header="Employee2"
Name="Employee2Data">
<TreeViewItem Header="Work Days"
Name="emp2WorkDays"
Selected="GetSchedule"
Unselected="SetSchedule">
<TreeViewItem Header="Monday" />
<TreeViewItem Header="Wednesday"/>
</TreeViewItem>
</TreeViewItem>
private void OnExpanded(object sender, RoutedEventArgs e)
{
//Perform actions when the TreeViewItem is expanded
}
Private Sub OnExpanded(ByVal sender As Object, ByVal e As RoutedEventArgs)
'Perform actions when the TreeViewItem is expanded
End Sub
注解
当 展开以便其子元素可见时 TreeViewItem ,会发生此事件。
路由事件信息
标识符字段 | ExpandedEvent |
路由策略 | 鼓 泡 |
委托 | RoutedEventHandler |