Skip to main content

InRibbonGallery.InitDropDownGallery Event

Enables the gallery, when it’s displayed as a dropdown window, to be customized.

Namespace: DevExpress.XtraBars.Ribbon.Gallery

Assembly: DevExpress.XtraBars.v24.1.dll

NuGet Package: DevExpress.Win.Navigation

Declaration

[DXCategory("Layout")]
public event InplaceGalleryEventHandler InitDropDownGallery

Event Data

The InitDropDownGallery event's data class is DevExpress.XtraBars.Ribbon.InplaceGalleryEventArgs.

Remarks

The InitDropDownGallery event is raised when an end-user presses the RibbonGalleryBarItem‘s Dropdown button. Clicking this button displays the bar item’s in-place gallery (which is specified by the RibbonGalleryBarItem.Gallery property) as a dropdown window. However, if a GalleryDropDown control is assigned to the RibbonGalleryBarItem.GalleryDropDown property, clicking the Dropdown button displays this control as a dropdown, but not the in-place gallery. The event allows you to customize the dropdown gallery before it’s displayed.

If no control is assigned to the RibbonGalleryBarItem.GalleryDropDown object clicking the Dropdown button does the following:

  • generates a new InDropDownGallery object from the bar item’s in-place Gallery (all gallery items are copied to the new gallery by references)
  • fires the InitDropDownGallery event and passes the newly created gallery as the event’s PopupGallery parameter.

If a GalleryDropDown control is assigned to the RibbonGalleryBarItem.GalleryDropDown property clicking the Dropdown button fires the InitDropDownGallery event whose PopupGallery parameter refers to the gallery of the specified GalleryDropDown control.

Example

In this example the Dropdown Gallery is created from the existing gallery. The full code can be found in the ‘RibbonSimplePad’ demo which is supplied with the XtraBars.

private void rgbiSkins_Gallery_InitDropDownGallery(object sender, 
DevExpress.XtraBars.Ribbon.InplaceGalleryEventArgs e) {
    e.PopupGallery.CreateFrom(rgbiSkins.Gallery);
    e.PopupGallery.AllowFilter = false;
    e.PopupGallery.ShowItemText = true;
    e.PopupGallery.ShowGroupCaption = true;
    e.PopupGallery.AllowHoverImages = false;
    foreach(GalleryItem item in e.PopupGallery.Groups[0].Items)
        item.Image = item.HoverImage;
    e.PopupGallery.ColumnCount = 2;
    e.PopupGallery.ImageSize = new Size(70, 36);
}

The image below shows the result.

InPlaceGallery_InitDropDown

See Also