windowsforms-devexpress-dot-xtrabars-dot-navigation-dot-accordioncontrol-4ce29a08.md
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.v25.2.dll
NuGet Package : DevExpress.Win.Navigation
[DXCategory("Events")]
public event CustomDrawElementEventHandler CustomDrawElement
<DXCategory("Events")>
Public Event CustomDrawElement As CustomDrawElementEventHandler
The CustomDrawElement event's data class is DevExpress.XtraBars.Navigation.CustomDrawElementEventArgs.
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.
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)));
}
}
Private Sub accordionControl1_CustomDrawElement(ByVal sender As Object, ByVal e As CustomDrawElementEventArgs)
If e.ObjectInfo.Element = filterPeopleElement
OrElse e.ObjectInfo.Element = filterMailElement Then
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)))
End If
End Sub
See Also