Skip to main content

AccordionControl.CustomDrawHamburgerButton Event

Fires before the hamburger button is displayed. Provides access to a drawing surface and allows you to draw the hamburger button.

Namespace: DevExpress.XtraBars.Navigation

Assembly: DevExpress.XtraBars.v24.2.dll

Declaration

[DXCategory("Events")]
public event CustomDrawHamburgerButtonEventHandler CustomDrawHamburgerButton

Event Data

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

Property Description
Bounds Gets the hamburger button bounds.
Cache Provides access to a drawing surface and a pen/brush/font cache.
Handled Gets or sets whether the event is handled.
State Gets the hamburger button state: normal, hot tracked, pressed, disabled, or selected.

The event data class exposes the following methods:

Method Description
DefaultDraw() Draws the default hamburger button.

Example

The code below shows how to draw a custom image in the hamburger button.

private void accordionControl_CustomDrawHamburgerButton(object sender, CustomDrawHamburgerButtonEventArgs e) {
    // The State event argument returns whether the hamburger button is
    // enabled, disabled, hot tracked, etc.
    if (e.State == DevExpress.Utils.Drawing.ObjectState.Normal) {
        SvgImage image = svgImageCollection1[1];
        var palette = SvgPaletteHelper.GetSvgPalette(this.LookAndFeel, ObjectState.Normal);
        e.Cache.DrawImage(image.Render(e.Bounds.Size, palette), e.Bounds.Location);
        // The Handled event argument should be set to true
        // to prevent the default draw algorithm from being invoked.
        e.Handled = true;
    }
}
See Also