I decided to throw away the "old school" windows baloon notifications and use the new windows 10 native toast notifications.
Right now, I'm struggling with referencing an icon for the toast notification. According to the Microsocft documentation (here and here), I should be able to add a notification icon like this:
// Get a toast XML template
var toastXml = ToastNotificationManager.GetTemplateContent(ToastTemplateType.ToastImageAndText04);
// Create image element
var image = toastXml.CreateElement("image");
image.SetAttribute("src", "https://picsum.photos/48?image=883");
image.SetAttribute("placement", "appLogoOverride");
toastXml.DocumentElement.AppendChild(image);
Instead, a default application icon appears:
The only way that is actually working is to use an absolute path to the image:
"file:///" + Path.GetFullPath("../../Assets/myicon.png");
That however, doesn't satisfy my needs because I either need to reference a resource icon or an icon from the web.
Hence my questions:
- How can I properly reference a web image (
https://picsum.photos/48?image=883
) in my toast notification? - How can I properly reference a resource icon?
- What image types are allowed in the toast notifications icons? Am I able to reference, for example the
.svg
image?