Back to Devexpress

AccordionControl.QueryElementIndent Event

windowsforms-devexpress-dot-xtrabars-dot-navigation-dot-accordioncontrol-d86d5a11.md

latest3.0 KB
Original Source

AccordionControl.QueryElementIndent Event

Allows you specify a custom indent for each accordion item.

Namespace : DevExpress.XtraBars.Navigation

Assembly : DevExpress.XtraBars.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
[DXCategory("Events")]
public event EventHandler<QueryElementIndentEventArgs> QueryElementIndent
vb
<DXCategory("Events")>
Public Event QueryElementIndent As EventHandler(Of QueryElementIndentEventArgs)

Event Data

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

PropertyDescription
ElementGets the processed accordion element.
IndentGets or sets the element’s indent.
LevelGets 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:

csharp
void accordionControl1_QueryElementIndent(object sender, QueryElementIndentEventArgs e) {
    if (e.Level == 1 && !e.Element.OwnerElement.Elements.Any(i => i.Style == ElementStyle.Group))
        e.Indent = 18;
}
vb
Private Sub accordionControl1_QueryElementIndent(ByVal sender As Object, ByVal e As QueryElementIndentEventArgs)
    If e.Level = 1 AndAlso Not e.Element.OwnerElement.Elements.Any(Function(i) i.Style = ElementStyle.Group) Then e.Indent = 18
End Sub

See Also

AccordionControl Class

AccordionControl Members

DevExpress.XtraBars.Navigation Namespace