I needed a quick way to pop a Toast Notification in a WPF app using Win 10 APIs. I started by taking a look at this sample and decided to strip away some unnecessary code that I didn’t need. I landed with this version which doesn’t subscribe to the ToastActivated, ToastDismissed or ToastFailed event handlers. Keep in mind that you’ll need to add references to the following files if creating this from scratch:
- Browse and find the following file: C:\Program Files (x86)\Windows Kits\10\UnionMetadata\winmd. Add it to your project as a reference. Note: You will need to change the filter to “All Files”.
- Browse and find the directory “C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETCore\v4.5”. Add System.WindowsRuntime.dll to your project.
Here is a demo of it in action.
Again, this is something that I needed and decided I’d share. In case you haven’t noticed, I’ve started blogging about things that I’m interested in or working on. I’ve recently wrote 3 other blog posts :
- Open UWP apps through Edge or a Web Browser Link
- Calling Windows 10 APIs From a Desktop Application
- Command Line Fun for Windows 10 Users
Be sure to check them out and if you use Twitter, then I’m on there as well. As always, thanks for reading and smash one of those share buttons to give this post some love if you found it helpful. Also, feel free to leave a comment below.