How to add menu to an app? #318

Closed
opened 2026-01-29 16:36:20 +00:00 by claunia · 5 comments
Owner

Originally created by @win32nipuh on GitHub (May 15, 2019).

Originally assigned to: @GregorBiswanger on GitHub.

How to add yet another menu to the app?
For example: the default menu is
File, Edit, View, Window, Help

I'd like to add my menu item + subitems
File, Edit, View, Tools (Options, Customize), Window, Help

How to do it?
When I do as in example, sipmle :
var menu = new MenuItem[]
{
new MenuItem
{
Label = "Tools",
Click = async () =>
{
await Electron.Dialog.ShowMessageBoxAsync("Go-go Pockemon!");
}
}
};
Electron.Menu.SetApplicationMenu(menu);

it replaces entire application menu.

Originally created by @win32nipuh on GitHub (May 15, 2019). Originally assigned to: @GregorBiswanger on GitHub. How to add yet another menu to the app? For example: the default menu is File, Edit, View, Window, Help I'd like to add my menu item + subitems File, Edit, View, **Tools (Options, Customize)**, Window, Help How to do it? When I do as in example, sipmle : [ var menu = new MenuItem[] { new MenuItem { Label = "Tools", Click = async () => { await Electron.Dialog.ShowMessageBoxAsync("Go-go Pockemon!"); } } }; Electron.Menu.SetApplicationMenu(menu); ](url) it replaces entire application menu.
claunia added the question label 2026-01-29 16:36:20 +00:00
Author
Owner

@win32nipuh commented on GitHub (May 16, 2019):

Danke Gregor! :-)

@win32nipuh commented on GitHub (May 16, 2019): Danke Gregor! :-)
Author
Owner

@GregorBiswanger commented on GitHub (May 16, 2019):

The native Electron has a default development menu.
If you add your own menu, this will be used.
You can not use the development menu and your own menu together..

@GregorBiswanger commented on GitHub (May 16, 2019): The native Electron has a default development menu. If you add your own menu, this will be used. You can not use the development menu and your own menu together..
Author
Owner

@win32nipuh commented on GitHub (May 16, 2019):

Ok, if I understand correctly it means: if I need to add my menu item I need create my own menu with the same items File, Edit etc, add my own and then replace application menu ?

@win32nipuh commented on GitHub (May 16, 2019): Ok, if I understand correctly it means: if I need to add my menu item I need create my own menu with the same items File, Edit etc, add my own and then replace application menu ?
Author
Owner

@GregorBiswanger commented on GitHub (May 16, 2019):

Yes, you have to implement that yourself again. Is a native Electron behavior.

@GregorBiswanger commented on GitHub (May 16, 2019): Yes, you have to implement that yourself again. Is a native Electron behavior.
Author
Owner

@win32nipuh commented on GitHub (May 16, 2019):

ok, I see. Please close this question.

@win32nipuh commented on GitHub (May 16, 2019): ok, I see. Please close this question.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/Electron.NET#318