Skip to main content
All docs
V24.2

AccordionControl.QueryElementIndent Event

Allows you specify a custom indent for each accordion item.

Namespace: DevExpress.XtraBars.Navigation

Assembly: DevExpress.XtraBars.v24.2.dll

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