Working with toast notifications
Regardless of the platform and the deployment model of your choice, the first step is to install the Windows Community Toolkit package dedicated to notifications. Right-click on your project, choose Manage NuGet packages, and look for the package with CommunityToolkit.WinUI.Notifications as an identifier.
Note
Despite the package name containing the WinUI keyword, it isn't specific only for this platform, and can work also with WPF, Windows Forms, or UWP.
The other requirement is to use a dedicated TargetFramework
for Windows 10 or 11 since the toolkit needs to consume some APIs from the Universal Windows Platform. In our scenario, we're building a WinUI application, so we're good to go. If you're using Windows Forms or WPF, instead, make sure to set the TargetFramework
at least as follows:
<TargetFramework>net6.0-windows10.0.19041.0 </TargetFramework>
In the case of a WinUI project, there&apos...