Skip to main content

DXPopupMenu.MultiColumn Property

Gets or sets whether items in this DXPopupMenu can be displayed in multiple columns.

Namespace: DevExpress.Utils.Menu

Assembly: DevExpress.Utils.v24.1.dll

NuGet Packages: DevExpress.Utils, DevExpress.Wpf.Core

Declaration

[DefaultValue(DefaultBoolean.Default)]
public DefaultBoolean MultiColumn { get; set; }

Property Value

Type Default Description
DefaultBoolean Default

A DefaultBoolean enumerator value that specifies whether or not items in this DXPopupMenu can be displayed in multiple columns.

Available values:

Name Description Return Value
True

The value is true.

0

False

The value is false.

1

Default

The value is specified by a global option or a higher-level object.

2

Remarks

By default, items in a DXPopupMenu whose DXPopupMenu.MenuViewType equals Menu, are arranged in a single column, one under the other. To arrange items in multiple columns, set the MultiColumn property to DefaultBoolean.True, then access the DXPopupMenu.OptionsMultiColumn property and specify the ColumnCount property to set the desired number of item columns.

Note

DXMenuHeaderItem objects are not affected by using a multi-column layout.

Example

The following code illustrates how to display a menu-styled DXPopupMenu on a right mouse click. All items in the menu are arranged in three columns, as illustrated in the figure below.

DXPopupMenu - MultiColumn

using DevExpress.Images;

namespace MultiColumnMenu {
    public partial class Form1 : XtraForm {
        public DXPopupMenu menu = new DXPopupMenu() { MenuViewType = MenuViewType.Menu};

        public Form1() {
            InitializeComponent();
            InitializeMenu();
        }

        public void InitializeMenu() {
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
            menu.Items.Add(new DXMenuHeaderItem() { Caption = "Text" });
            menu.Items.Add(new DXMenuItem("Cut", null, DevExpress.Images.ImageResourceCache.Default.GetImage("images/edit/cut_16x16.png")));
            menu.Items.Add(new DXMenuItem("Copy", null, DevExpress.Images.ImageResourceCache.Default.GetImage("images/edit/copy_16x16.png")));
            menu.Items.Add(new DXMenuItem("Paste", null, DevExpress.Images.ImageResourceCache.Default.GetImage("images/edit/paste_16x16.png")));
            menu.Items.Add(new DXMenuHeaderItem() {Caption="File"});
            menu.Items.Add(new DXMenuItem("New", null, DevExpress.Images.ImageResourceCache.Default.GetImage("images/actions/new_16x16.png")));
            menu.Items.Add(new DXMenuItem("Open", null, DevExpress.Images.ImageResourceCache.Default.GetImage("images/actions/open_16x16.png")));
            menu.Items.Add(new DXMenuItem("Save", null, DevExpress.Images.ImageResourceCache.Default.GetImage("images/save/save_16x16.png")));
            menu.MultiColumn = DevExpress.Utils.DefaultBoolean.True;
            menu.OptionsMultiColumn.ColumnCount = 3;
            menu.OptionsMultiColumn.ShowItemText = DevExpress.Utils.DefaultBoolean.True;
        }

        private void memoEdit1_MouseUp(object sender, MouseEventArgs e) {
            if (e.Button == System.Windows.Forms.MouseButtons.Right) {
                ((IDXDropDownControl)menu).Show(ribbonControl1, this, e.Location);
            }
        }
    }
}
See Also