AccordionControl.HasContentContainer Event

Allows you to specify whether an item, when expanded, will display a custom control container. The custom control container should be provided by handling the AccordionControl.GetContentContainer event.

Namespace: DevExpress.XtraBars.Navigation

Assembly: DevExpress.XtraBars.v20.1.dll

Declaration

[DXCategory("Events")]
public event HasContentContainerEventHandler HasContentContainer
<DXCategory("Events")>
Public Event HasContentContainer As HasContentContainerEventHandler

Event Data

The HasContentContainer event's data class is DevExpress.XtraBars.Navigation.HasContentContainerEventArgs.

Remarks

An item (see AccordionControlElement.Style) can be used in two ways:

  • It can act as a simple button. The AccordionControlElementBase.Click and AccordionControl.ElementClick events fire on an item header click, allowing you to perform certain actions.

    AccordionControl-4Items

  • It can act as an expandable element. A click on the item's header or on the built-in expand button shows a control container that accommodates custom controls.

    Win-Accordion-ItemWithContainer.gif

You can associate a custom control container with an item in advance, by using the AccordionControlElementBase.ContentContainer property.

If you prefer associating custom controls with items dynamically, handle the HasContentContainer and AccordionControl.GetContentContainer events.

The HasContentContainer event fires when an empty item (i.e., an item with no content container assigned to it) is about to be rendered for the first time onscreen.

If you set the event's HasContentContainerEventArgs.HasContentContainer Boolean parameter to true, this item is rendered as though it already has a content container assigned. The item's header text will be painted in a bold font plus the header will have the expand/collapse button. When this item is expanded, the AccordionControl.GetContentContainer event fires. You should handle this event to provide a custom content container for the item. Assign an AccordionContentContainer accommodating custom controls to the event's ContentContainer parameter. In addition, specify the container's height with the AccordionContentContainer.Height property.

The AccordionControl.GetContentContainer event does not fire for an item if the HasContentContainerEventArgs.HasContentContainer event parameter is set to false.

See Also