Skip to main content
A newer version of this page is available. .

AccordionControl.CustomDrawElement Event

Fires before a group or item is displayed. Provides access to a drawing surface and allows you to draw the processed element.

Namespace: DevExpress.XtraBars.Navigation

Assembly: DevExpress.XtraBars.v19.2.dll

Declaration

[DXCategory("Events")]
public event CustomDrawElementEventHandler CustomDrawElement

Event Data

The CustomDrawElement event's data class is DevExpress.XtraBars.Navigation.CustomDrawElementEventArgs.

Remarks

The following code from the Hamburger Menu demo calls the e.DrawHeaderBackground and e.DrawText methods to paint elements with default appearance, then uses the FillRectangle method to draw a white stripe along the left edge of a selected element.

customdraw

private void accordionControl1_CustomDrawElement(object sender, CustomDrawElementEventArgs e) {
    if(e.ObjectInfo.Element == filterPeopleElement || e.ObjectInfo.Element == filterMailElement) {
        e.Handled = true;
        e.DrawHeaderBackground();
        e.DrawText();
        e.Cache.FillRectangle(
            e.ObjectInfo.PaintAppearance.ForeColor,
            new Rectangle(
                e.ObjectInfo.HeaderBounds.Location,
                new Size(ScaleHelper.ScaleHorizontal(3),
                e.ObjectInfo.HeaderBounds.Height)));
    }
}
See Also