Expander.Collapsed 事件

定义

Expander 控件的内容窗口关闭且只有 Header 可见时发生。

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

事件类型

示例

以下示例演示如何为 Collapsed 事件指定事件处理程序。

myExpander.Collapsed += new RoutedEventHandler(expanderHasCollapsed);
AddHandler myExpander.Collapsed, AddressOf expanderHasCollapsed
<Expander Name ="myExpander" Collapsed="expanderHasCollapsed" 
          Header ="expanderTitle" Content="expanderContent"/>

以下示例演示如何定义事件处理程序。

private void expanderHasCollapsed(object sender, RoutedEventArgs args)
{
    //Do something when the Expander control collapses
}
Private Sub expanderHasCollapsed(ByVal sender As Object, ByVal args As RoutedEventArgs)
    'Do something when the Expander control collapses
End Sub

注解

Collapsed属性从 truefalse更改为 时IsExpanded发生 该事件。

路由事件信息

标识符字段 CollapsedEvent
路由策略 鼓 泡
委托 RoutedEventHandler

适用于

另请参阅