macosxamarinxamarin.mac

Xamarin Mac minimize to tray on close button


I want change behavior of standard close button of window. When user clicked on it then minimize to tray, not close window. How can I do this?

P.S Here is a small video example of this behavior on Slack application. I want do sameenter image description here.


Solution

  • Override the applicationShouldTerminateAfterLastWindowClosed method in appdelegate like:

    public override bool ApplicationShouldTerminateAfterLastWindowClosed(NSApplication sender)
    {
    return false;
    }