I've got a status menu on a tray icon application with Xamarin Mac. There is no window shown by setting Application is agent (UIElement) to 1. A login window must only be shown after a menuItem is clicked. (which is connected using a action.)
The following code initialized a new MainWindowController after a button is clicked. This action is called because a breakpoint is hit, yet no window is shown.
partial void OpenLoginWindow(NSMenuItem sender)
{
var loginController = new MainWindowController();
loginController.Window.MakeKeyAndOrderFront(this);
loginController.ShowWindow(this);
}
When I set Application is agent (UIElement) back to 0. The window gets shown when the dock icon is clicked. But when the login menu item is clicked, the window are initialized, but it is not brought to the front.
The Main nib file name in Info.plist is set to MainMenu which is not the file for the window.
In Visual Studio for Mac, right-click on the existing Xamarin. Forms solution and choose Add > Add New Project... In the New Project window choose Mac > App > Cocoa App and press Next.
With Xamarin. Forms, you can use C# or XAML to build cross-platform user interfaces for iOS, Android, and macOS.
The Mac is required for building as well as running the iOS simulator. You can either use it as a build server, and actually do your development in Visual Studio (either in a standalone PC, or on a VM running on your Mac), or you can do your development directly on the Mac using Xamarin Studio as your IDE.
Visual Studio 2022 for Mac includes nearly everything you'll need for .NET 7 development, from responsive C# web UIs in Blazor to event-driven solutions using Azure Functions.
Looks like this always works. But because the application is set to Application is agent (UIElement) no dock item is shown and does not show when ALT+TAB'ing. Because Xamarin Studio had focus the window was started in the background.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With