I created a WpfApplication in C# (with Visual Studio Community 2015) and i'd like to send some windows 10 notifications. I think that I'm supposed to use "ToastContent" then add it into a "ToastNotification",...
I've add "Microsoft.Toolkit.Uwp.Notification" but I can't add "Microsoft.Toolkit.Uwp.UI" (that I think is needed to display the notification). It says :
Could not install package 'Microsoft.Toolkit.Uwp 1.2.0'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.6', but the package does not contain any assembly references or content files that are compatible with that framework.
What can I do to install this package ? Or is there another solution to launch a windows 10 notification ?
Thank you :)
Ok, after a few hours of searching, this is kind of easy...
Step 1 : Unload the projet then add to the first property group this element : <targetplatformversion>10.0</targetplatformversion>
Step 2 : Reload the projet
Step 3 : Add references to your project "Windows > Core > Windows.Data & Windows.UI"
Step 4 :
string xml = $@"
<toast>
<visual>
<binding template='ToastGeneric'>
<text>Some title</text>
<text>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</text>
</binding>
</visual>
</toast>";
XmlDocument doc = new XmlDocument();
doc.LoadXml(xml);
var toast = new ToastNotification(doc);
ToastNotificationManager.CreateToastNotifier("ToastDesktop").Show(toast);
Enjoy :) !
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With