windowsforms-devexpress-dot-xtrabars-dot-navigation-dot-accordioncontrol-0bd905da.md
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.v25.2.dll
NuGet Package : DevExpress.Win.Navigation
[DXCategory("Events")]
public event CustomDrawHamburgerButtonEventHandler CustomDrawHamburgerButton
<DXCategory("Events")>
Public Event CustomDrawHamburgerButton As CustomDrawHamburgerButtonEventHandler
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. |
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;
}
}
Private Sub accordionControl1_CustomDrawHamburgerButton(ByVal sender As Object, ByVal e As DevExpress.XtraBars.Navigation.CustomDrawHamburgerButtonEventArgs) _
Handles accordionControl1.CustomDrawHamburgerButton
' The State event argument returns whether the hamburger button is
' enabled, disabled, hot tracked, etc.
If e.State = DevExpress.Utils.Drawing.ObjectState.Normal Then
Dim image As SvgImage = svgImageCollection1(0)
Dim palette = SvgPaletteHelper.GetSvgPalette(Me.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
End If
End Sub
See Also