Edit

Share via


Expander.Collapsed Event

Definition

Occurs when the content window of an Expander control closes and only the Header is visible.

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

Event Type

Examples

The following example shows how to specify the event handler for the Collapsed event.

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

The following example shows how to define the event handler.

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

Remarks

The Collapsed event occurs when the IsExpanded property changes from true to false.

Routed Event Information

Identifier field CollapsedEvent
Routing strategy Bubbling
Delegate RoutedEventHandler

Applies to

See also