Skip to main content

RadialMenu Class

The menu where items are arranged along the circumference.

Namespace: DevExpress.XtraBars.Ribbon

Assembly: DevExpress.XtraBars.v24.2.dll

Declaration

public class RadialMenu :
    PopupMenuBase,
    ICustomizationMenuFilterSupports,
    IExtenderProvider

Remarks

A Radial Menu is a fully customizable Microsoft Note 2013 inspired pop-up menu. See the Radial Menu topic to learn more.

Note

For the RadialMenu to work correctly, it must be placed on a form containing a BarManager or RibbonControl. Ensure that the menu’s PopupMenuBase.Manager or PopupMenuBase.Ribbon inherited property is initialized with a BarManager or RibbonControl.

Online Video

Example

This example creates a WinForms Radial Menu:

WinForms Radial Menu - DevExpress

View Example: Create and Show a WinForms Radial Menu

using System.Drawing;
using System.Windows.Forms;
using DevExpress.XtraBars.Ribbon;
using DevExpress.XtraBars;

namespace CreateRadialMenu {
    public partial class Form1 : Form {
        public Form1() {
            InitializeComponent();

            barManager = barManager1;
            barManager.ItemClick += new ItemClickEventHandler(barManager_ItemClick);
            // Create Radial Menu
            radialMenu = new RadialMenu(barManager);
            radialMenu.AddItems(GetRadialMenuItems(barManager));
        }

        BarManager barManager;
        RadialMenu radialMenu;

        private void btnShowRadialMenu_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) {
            // Display Radial Menu
            if (radialMenu == null) return;
            Point pt = this.Location;
            pt.Offset(this.Width / 2, this.Height / 2);
            radialMenu.ShowPopup(pt);
        }

        BarItem[] GetRadialMenuItems(BarManager barManager) {
            // Create bar items to display in Radial Menu
            BarItem btnCopy = new BarButtonItem(barManager, "Copy");
            btnCopy.ImageOptions.ImageUri.Uri = "Copy;Size16x16";

            BarItem btnCut = new BarButtonItem(barManager, "Cut");
            btnCut.ImageOptions.ImageUri.Uri = "Cut;Size16x16";

            BarItem btnDelete = new BarButtonItem(barManager, "Delete");
            btnDelete.ImageOptions.ImageUri.Uri = "Delete;Size16x16";

            BarItem btnPaste = new BarButtonItem(barManager, "Paste");
            btnPaste.ImageOptions.ImageUri.Uri = "Paste;Size16x16";

            // Sub-menu with 3 check buttons
            BarSubItem btnMenuFormat = new BarSubItem(barManager, "Format");
            BarCheckItem btnCheckBold = new BarCheckItem(barManager, false);
            btnCheckBold.Caption = "Bold";
            btnCheckBold.ImageOptions.ImageUri.Uri = "Bold;Size16x16";

            BarCheckItem btnCheckItalic = new BarCheckItem(barManager, true);
            btnCheckItalic.Caption = "Italic";
            btnCheckItalic.ImageOptions.ImageUri.Uri = "Italic;Size16x16";

            BarCheckItem btnCheckUnderline = new BarCheckItem(barManager, false);
            btnCheckUnderline.Caption = "Underline";
            btnCheckUnderline.ImageOptions.ImageUri.Uri = "Underline;Size16x16";

            BarItem[] subMenuItems = new BarItem[] { btnCheckBold, btnCheckItalic, btnCheckUnderline };
            btnMenuFormat.AddItems(subMenuItems);

            BarItem btnFind = new BarButtonItem(barManager, "Find");
            btnFind.ImageOptions.ImageUri.Uri = "Find;Size16x16";

            BarItem btnUndo = new BarButtonItem(barManager, "Undo");
            btnUndo.ImageOptions.ImageUri.Uri = "Undo;Size16x16";

            BarItem btnRedo = new BarButtonItem(barManager, "Redo");
            btnRedo.ImageOptions.ImageUri.Uri = "Redo;Size16x16";

            return new BarItem[] {btnCopy, btnCut, btnDelete, btnPaste, btnMenuFormat, btnFind, btnUndo, btnRedo};
        }

        void barManager_ItemClick(object sender, ItemClickEventArgs e) {
            //...
            Text = "Item clicked: " + e.Item.Caption;
        }
    }
}
See Also