C
C#9mo ago
Luc ♡

Is there any reason I should not use Winforms NotifyIcon on windows with maui?

I never did a tray icon before, so naturally i googled. I stumbled upon this after a while https://github.com/dotnet/maui-samples/blob/main/8.0/Apps/WeatherTwentyOne/src/WeatherTwentyOne/Platforms/Windows/NativeWindowing/WindowsTrayIcon.cs However that had no way of doing a context menu on the tray icon. Then I figured out you can just use System.WIndows.Forms.NotifyIcon for it, and it would just work. Is there any reason I should not be using this on a windows compile target for my maui app? Why is there this alternative way of poking win apis directly?
GitHub
maui-samples/8.0/Apps/WeatherTwentyOne/src/WeatherTwentyOne/Platfor...
Samples for .NET Multi-Platform App UI (.NET MAUI) - dotnet/maui-samples
No description
1 Reply
Lex Li
Lex Li9mo ago
Different platforms give you different features and limitations, so a cross platform design often removes certain platform specific things to achieve unified API surface across a set of platforms. If you do want to use the native Windows control to get more features, do at your will and MAUI allows that. That's literally what https://learn.microsoft.com/en-us/dotnet/maui/platform-integration/invoke-platform-code?view=net-maui-8.0 tries to tell you.
Want results from more Discord servers?
Add your server