Skip to main content

AccordionControl.ExpandStateChanging Event

Fires when an element is about to be expanded/collapsed. Allows you to implement a custom element expansion behavior.

Namespace: DevExpress.XtraBars.Navigation

Assembly: DevExpress.XtraBars.v24.1.dll

NuGet Package: DevExpress.Win.Navigation

Declaration

[DXCategory("Events")]
public event ExpandStateChangingEventHandler ExpandStateChanging

Event Data

The ExpandStateChanging event's data class is ExpandStateChangingEventArgs. The following properties provide information specific to this event:

Property Description
Element Gets the current element that is about to be expanded/collapsed.
ElementsToExpandCollapse Gets the list of elements to be additionally expanded/collapsed.
NewState Gets the new expansion state into which the currently processed element (ExpandStateChangingEventArgs.Element) will be set after your ExpandStateChanging event handler is complete.

Remarks

To implement custom element expansion logic, set the AccordionControl.ExpandElementMode property to Multiple and handle the ExpandStateChanging event.

The ExpandStateChanging event fires when an element (e.Element) is about to be expanded/collapsed. The element’s new state is specified by the event’s e.NewState parameter.

To expand/collapse other elements in code, add these elements to the e.ElementsToExpandCollapse list. Each list item identifies an element to be expanded/collapsed and the new expansion state for this element. After your ExpandStateChanging event handler is complete, the AccordionControl traverses through the e.ElementsToExpandCollapse list and expands/collapses corresponding elements.

Initially, the e.ElementsToExpandCollapse list contains a single item, which is the currently processed element (e.Element).

See Also