We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to populate the WinForms PopupMenu?

Platform: WinForms |
Control: PopupMenu

Populate a PopupMenu

The first thing to populate a PopupMenu is to set the ParentBarItem property. This can be achieved in one of the following ways:

Using the Designer

There are 2 scenarios tp populate the PopupMenu:

Case 1: You have a BarManager (ChildFrameBarManager or MainFrameBarManager) in your form. In this case, you might want to use a ParentBarItem in the BarManager as your PopupMenu’s ParentBarItem too. If so, just select the appropriate ParentBarItem in the PopupMenu’s property browser.

Once you do so, you can select the "Customize" verb in the PopupMenu designer to invoke the "PopupMenu Form" designer to view the PopupMenu that you will be designing. You can now just drag-and-drop items from your BarManager "Customize" dialog into the PopupMenu. To delete an item, right click on it and select "Delete". To introduce grouping, right-click on the item and select "Begin A Group".

If you want to use a ParentBarItem that is not contained within a BarManager, have a look at Case 2.

Case 2: You do not have a BarManager in your form. If you already have a ParentBarItem that you want to use in your PopupMenu then just select it in the Property browser. If not, select the "Add Default ParentBarItem" verb in the PopupMenu designer. This will create a new ParentBarItem and use it in the PopupMenu.

You can now populate the PopupMenu by editing the ParentBarItem’s Items list (via its Collection Editor). You can see the popup getting designed through the "Customize" verb, but you cannot visually edit it like in the above case.

Through Code

Populating the menus in code is simple:


this.popupMenu1 = new Syncfusion.Windows.Forms.Tools.PopupMenu();
this.editMenu = new Syncfusion.Windows.Forms.Tools.ParentBarItem();
this.editMenu.Text = "&Edit";
this.editMenu.Items.AddRange(new BarItem[] {this.cutItem, this.copyItem});
this.popupMenu1.ParentBarItem = this.editMenu;


Me.popupMenu1 = New Syncfusion.Windows.Forms.Tools.PopupMenu()
Me.editMenu = New Syncfusion.Windows.Forms.Tools.ParentBarItem()
Me.editMenu.Text = "&Edit"
Me.editMenu.Items.AddRange(New BarItem() {Me.cutItem, Me.copyItem})
Me.popupMenu1.ParentBarItem = Me.editMenu


2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile