Skip to main content

DXButtonGroupItem Class

A group of buttons that can be displayed within a DXPopupMenu object.

Namespace: DevExpress.Utils.Menu

Assembly: DevExpress.Utils.v24.2.dll

Declaration

public class DXButtonGroupItem :
    DXSubMenuItem

Remarks

A DXPopupMenu can be displayed as a regular menu, popup bar or RibbonMiniToolbar object (see DXPopupMenu.MenuViewType). A DXButtonGroupItem object added to a DXPopupMenu is visualized differently depending on the popup menu’s display mode:

DXPopupMenu View Types

To add a DXButtonGroupItem object to a DXPopupMenu, use the popup menu’s inherited DXSubMenuItem.Items property.

Example

The example demonstrates how to add two DXButtonGroupItem objects to a DXPopupMenu, and display the menu as a RibbonMiniToolbar.

DX Button Group Item

using DevExpress.LookAndFeel;
using DevExpress.Utils.Menu;

private void Form1_MouseDown(object sender, MouseEventArgs e) {
    Control parentControl = this;
    Point pt;
    pt = e.Location;
    DXPopupMenu dxPopupMenu = new DXPopupMenu();
    DXButtonGroupItem buttonGroup = new DXButtonGroupItem();
    EventHandler handler = new EventHandler(ItemClick);
    buttonGroup.Items.Add(new DXMenuItem("Undo", handler, Image.FromFile("..\\..\\undo32x32.png")));
    buttonGroup.Items.Add(new DXMenuItem("Cut", handler, Image.FromFile("..\\..\\cut32x32.png")));
    buttonGroup.Items.Add(new DXMenuItem("Redo", handler, Image.FromFile("..\\..\\redo32x32.png")));
    dxPopupMenu.Items.Add(buttonGroup);
    buttonGroup = new DXButtonGroupItem();
    buttonGroup.Items.Add(new DXMenuItem("Bold", handler, Image.FromFile("..\\..\\bold32x32.png")));
    buttonGroup.Items.Add(new DXMenuItem("Italic", handler, Image.FromFile("..\\..\\italic32x32.png")));
    buttonGroup.Items.Add(new DXMenuItem("Underline", handler, Image.FromFile("..\\..\\underline32x32.png")));
    dxPopupMenu.Items.Add(buttonGroup);
    dxPopupMenu.Items.Add(new DXMenuItem("About",handler));
    dxPopupMenu.Items.Add(new DXMenuItem("Exit",handler));
    dxPopupMenu.MenuViewType = MenuViewType.RibbonMiniToolbar;
    ((IDXDropDownControl)dxPopupMenu).Show(RibbonControl1, parentControl, pt);
}

void ItemClick (object sender, EventArgs e) {
    DXMenuItem item = sender as DXMenuItem;
    //You can identify an item by its caption
    //...
}

Inheritance

See Also