Back to Devexpress

AccordionControl.ContextButtonCustomize Event

windowsforms-devexpress-dot-xtrabars-dot-navigation-dot-accordioncontrol-7a427861.md

latest3.3 KB
Original Source

AccordionControl.ContextButtonCustomize Event

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

Namespace : DevExpress.XtraBars.Navigation

Assembly : DevExpress.XtraBars.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
[DXCategory("Events")]
public event AccordionControlContextButtonCustomizeEventHandler ContextButtonCustomize
vb
<DXCategory("Events")>
Public Event ContextButtonCustomize As AccordionControlContextButtonCustomizeEventHandler

Event Data

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

PropertyDescription
ContextItemGets a context item to customize.
ElementGets 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.

csharp
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;
}
vb
Private Sub accordionControl1_ContextButtonCustomize(ByVal sender As Object, ByVal e As AccordionControlContextButtonCustomizeEventArgs)
    'Item context buttons are shown only for items that have a content container assigned
    If e.Element.Style = ElementStyle.Item AndAlso e.Element.ContentContainer IsNot Nothing Then
        e.ContextItem.Visibility = DevExpress.Utils.ContextItemVisibility.Visible
    End If
End Sub

See Also

AccordionControl Class

AccordionControl Members

DevExpress.XtraBars.Navigation Namespace