共用方式為


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

備註

當 屬性從 true 變更為 falseIsExpanded ,就會發生此 Collapsed 事件。

路由事件資訊

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

適用於

另請參閱