Replies: 3 comments
-
hi @nils-kt I was able to achieve this by overriding the BuildMenu method in the /Platforms/MacCatalyst/AppDelegate.cs file. Removing all of those menu bar items would look like
|
Beta Was this translation helpful? Give feedback.
-
Doing @headintheclouds21 solution can cause issues if you still need the menu removed. I've been able to keep the menu and remove the system default items, in Mac Catalyst, by doing so (Cannot show full code due to NDA, but should be enough to get someone started): Platforms/MacCatalyst/AppDelegate.cspublic override void BuildMenu(IUIMenuBuilder builder)
{
base.BuildMenu(builder);
var fileMenuIdentifier = UIMenuIdentifier.File.GetConstant();
UIMenu fileMenu = builder.GetMenu(fileMenuIdentifier);
UIMenuElement[] fileMenuChildren = fileMenu.Children;
builder.ReplaceMenu(UIMenuIdentifier.File.GetConstant(), fileMenu.GetMenuByReplacingChildren(new UIMenuElement[]
{
fileMenuChildren[0] // Only keep the newly designed menu in WindowMenuEvent.cs
}));
// any additional code...
} WIndowMenuEvents.cspublic WindowMenuEvents(MainPage mainPage)
{
// Create MenuBarItems
MenuBarItem fileMenu = new MenuBarItem { Text = "File" };
// Create MenuFlyoutItems for File menu
MenuFlyoutItem menuItemNew = new MenuFlyoutItem { Text = "New" };
// openItem.Clicked += OpenFile_Clicked;
MenuFlyoutItem menuItemOpen = new MenuFlyoutItem { Text = "Open" };
MenuFlyoutItem exitItem = new MenuFlyoutItem { Text = "Quit" };
// Add MenuFlyoutItems to File menu
fileMenu.Add(menuItemNew);
fileMenu.Add(menuItemOpen);
fileMenu.Add(exitItem);
} It looks like anything you created additional to the system OS menu items will be at the beginning and then the system default items are pushed onto that array. |
Beta Was this translation helpful? Give feedback.
-
Hi, I wrote a blog post on handling the MacOS menu bar: https://msicc.net/a-deeper-look-into-menu-bar-handling-in-maccatalyst-apps-with-net-maui/ Hope it helps. |
Beta Was this translation helpful? Give feedback.
-
Hello, how can I remove the default macOS MenuBarItems?

Example:
Beta Was this translation helpful? Give feedback.
All reactions