Share via

WinForms menu control changes in Core 5

Brandon Stewart 141 Reputation points
2020-12-08T06:11:04.147+00:00

Is Microsoft (or anyone) going to provide documentation/tutorials on changes to WinForms controls under Core 5. I tried to add menu and sub menu items to a MenuStrip control and can't figure out how to add the submenu items. I've found similar changes in other user controls that I no longe know how to use under Core 5. This thing is a nightmare.

Developer technologies | Windows Forms

Answer accepted by question author

Daniel Zhang-MSFT 9,661 Reputation points
2020-12-08T08:38:24.717+00:00

Hi BrandonStewart-4522,
Starting in .NET Core 3.1, some Windows Forms controls have changed.
More details you can refer to this document.
And the Desktop Guide documentation for .NET 5 (and .NET Core) and is under construction.
Please refer to this document.
Viorel-1 has provided a method that add submenu in Properties panel.
You can also add these with code:
First, you can add an item to MenuStrip control with following code:

menuStrip1.Items.Add("Item title");  

Then to add a sub-menu, you can take an existing item and using DropDownItems to add.

(menuStrip1.Items[0] as ToolStripMenuItem).DropDownItems.Add("sub menu");  

Best Regards,
Daniel Zhang


If the response is helpful, please click "Accept Answer" and upvote it.

Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

Was this answer helpful?

0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Viorel 127K Reputation points
    2020-12-08T07:11:18.77+00:00

    In contrast with previous Window Forms, it seems that menus cannot be designed visually yet, but you can click “Items (Collection)…” and “DropDownItems (Collection)…” in Properties panel and dialogs to add items and subitems.

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.