Drastic.TrayWindow.Maui 1.0.3

There is a newer version of this package available.
See the version list below for details.
dotnet add package Drastic.TrayWindow.Maui --version 1.0.3                
NuGet\Install-Package Drastic.TrayWindow.Maui -Version 1.0.3                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Drastic.TrayWindow.Maui" Version="1.0.3" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Drastic.TrayWindow.Maui --version 1.0.3                
#r "nuget: Drastic.TrayWindow.Maui, 1.0.3"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Drastic.TrayWindow.Maui as a Cake Addin
#addin nuget:?package=Drastic.TrayWindow.Maui&version=1.0.3

// Install Drastic.TrayWindow.Maui as a Cake Tool
#tool nuget:?package=Drastic.TrayWindow.Maui&version=1.0.3                

NuGet Version License

Drastic.TrayWindow.Maui

Drastic.TrayWindow.Maui is a helper library for Drastic.TrayWindow, letting you intergrate it into your existing MAUI application.

Drastic.TrayWindow.Maui supports Mac Catalyst and WinUI.

Setup

First, for Mac Catalyst, you need to set it up to allow for multiple windows. You MUST following the documentation. Once you do this, verify that multiple window support works for your project. Then, install this nuget.

In your AppDelegate.cs, switch it to use MauiTrayUIApplicationDelegate

namespace Drastic.TrayWindow.Sample.Maui;

[Register("AppDelegate")]
public class AppDelegate : MauiTrayUIApplicationDelegate
{
	protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
}

Next, in your MauiProgram.cs, add AddTrayWindowSupport

 var builder = MauiApp.CreateBuilder();
        builder
            .AddTrayWindowSupport()
            .UseMauiApp<App>()
            .ConfigureFonts(fonts =>

Now you can add a tray window. This can only happen after the Maui Context has been created, so only after your first Maui Window has been created. Once you verify that has occured, you can then invoke the following helper:


        var image = App.GetResourceFileContent("favicon.png");

        Drastic.TrayWindow.Maui.MauiTrayWindow.Generate("Test", image!, new TrayWindowOptions(), new SamplePage());

Image is an image Stream, this could come from an existing MAUI image from your resources, or as a standalone file on your system.

Tips

  • While you can use Shell inside of the TrayWindow, you lose most of the functionality for page navigation and deep linking.
  • In general, use simple pages for best results. Trying to put your entire application inside of the tray is not ideal. Use discretion.
Product Compatible and additional computed target framework versions.
.NET net7.0-maccatalyst15.4 is compatible.  net7.0-windows10.0.19041 is compatible.  net8.0-maccatalyst was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.9 409 12/31/2022
1.0.8 299 12/27/2022
1.0.7 291 12/26/2022
1.0.6 293 12/25/2022
1.0.5 296 12/24/2022
1.0.4 288 12/24/2022
1.0.3 297 12/23/2022