mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-02-05 13:54:47 +00:00
How to add menu to an app? #318
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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.
@win32nipuh commented on GitHub (May 16, 2019):
Danke Gregor! :-)
@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..
@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 ?
@GregorBiswanger commented on GitHub (May 16, 2019):
Yes, you have to implement that yourself again. Is a native Electron behavior.
@win32nipuh commented on GitHub (May 16, 2019):
ok, I see. Please close this question.