I have .NET MAUI project developed for Windows and MacOS desktops. I want to minimize the application to the Dock on closing in MacOS platform, i.e. I want to hide the window but the application should continue the work in background (you can see how it works when you closing for example most of the messengers). In Windows platform I've made the functionality to minimize it to the tray with tray icon, tray menu and all of this kind of functionalities, but in MacOS I cannot find the solution. I will be very appreciated if someone can tell me how to do it.
Actually I've tried to use LifecycleEvents in MauiProgram.cs, but it's not configured as I see. Also I've tried to add deactivated event for window in App.xaml.cs, but there are no possibility to make it hidden and cancel this event.
Based on Apple's response, your requirement can be achieved when the Maui application supports multiple windows.
Specifically, you can add the
SceneDelegate
class to the Maui project and add the relevant xml to the macatalyst'sInfo.plist
file, Then override theOpenWindow
method in the app.xaml file:For more details, you can refer to the Multi-window support document.