Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

AccordionControl.ContextButtonCustomize Event

Fires before any context button is shown and allows you to dynamically customize it.

Namespace: DevExpress.XtraBars.Navigation

Assembly: DevExpress.XtraBars.v24.2.dll

NuGet Package: DevExpress.Win.Navigation

#Declaration

[DXCategory("Events")]
public event AccordionControlContextButtonCustomizeEventHandler ContextButtonCustomize

#Event Data

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

Property Description
ContextItem Gets a context item to customize.
Element Gets a AccordionControlElement that contains a context item to customize.

#Remarks

Accordion controls provide the AccordionControl.GroupContextButtons and AccordionControl.ItemContextButtons collections that store context buttons for groups and items respectively. The ContextButtonCustomize event is raised before any button is displayed. You can handle this event to modify a button, as shown in the sample code below.

void accordionControl1_ContextButtonCustomize(object sender, AccordionControlContextButtonCustomizeEventArgs e) {
    //Item context buttons are shown only for items that have a content container assigned
    if (e.Element.Style == ElementStyle.Item && e.Element.ContentContainer != null) e.ContextItem.Visibility = DevExpress.Utils.ContextItemVisibility.Visible;
}
See Also