Skip to main content
All docs
V24.2

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

AccordionControl.QueryElementIndent Event

Allows you specify a custom indent for each accordion item.

Namespace: DevExpress.XtraBars.Navigation

Assembly: DevExpress.XtraBars.v24.2.dll

NuGet Package: DevExpress.Win.Navigation

#Declaration

[DXCategory("Events")]
public event EventHandler<QueryElementIndentEventArgs> QueryElementIndent

#Event Data

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

Property Description
Element Gets the processed accordion element.
Indent Gets or sets the element’s indent.
Level Gets the element’s hierarchy level.

#Remarks

AccordionControl.ChildLevelIndent and AccordionControl.ChildIndentStartLevel properties do not allow you to define different indents for items at the same hierarchy level. Handle the QueryElementIndent event to specify item indents based on custom logic.

The following code snippet changes the indent of items at the first hierarchy level so it matches the sub-group indent:

WinForms Accordion - Custom Indent

void accordionControl1_QueryElementIndent(object sender, QueryElementIndentEventArgs e) {
    if (e.Level == 1 && !e.Element.OwnerElement.Elements.Any(i => i.Style == ElementStyle.Group))
        e.Indent = 18;
}
See Also