Answered by:
Rendering of Images for Toast Notifiaction

Question
-
Need to show a Toast Notification with Image and Text and hence using ImageandText01 template. I'm using public blob Url for rendering of the image. But the image is not displayed in the toast. Instead it shows a blank space for image. My image is less than 200KB and less than 1024X1024 in dimensions.
If I replace url with an image in the app files it perfectly renders it.
Below is the code snippet of the toast I'm trying to use to render the image. The same public blob url works for rendering the images of Live Tile. Do I need to perform any additional steps for rendering blob image to toast?
ToastTemplateType toasttemplate = ToastTemplateType.ToastImageAndText01; XmlDocument toastXml = ToastNotificationManager.GetTemplateContent(toasttemplate); XmlNodeList toastTextElements = toastXml.GetElementsByTagName("text"); toastTextElements[0].AppendChild(toastXml.CreateTextNode(obj.Desc)); XmlNodeList toastImageAttributes = toastXml.GetElementsByTagName("image"); ((XmlElement)toastImageAttributes[0]).SetAttribute("src", obj.ImageUrl.ToString()); ((XmlElement)toastImageAttributes[0]).SetAttribute("alt", "red graphic"); ToastNotification toast = new ToastNotification(toastXml); ToastNotificationManager.CreateToastNotifier().Show(toast);
Thanks & Regards Tejaswi Chandrapatla
Thursday, May 1, 2014 1:55 PM
Answers
-
I could see them now.. I wonder it worked after restart of my machine and running the app again.
Thanks & Regards Tejaswi Chandrapatla
- Marked as answer by Anne Jing Friday, May 9, 2014 7:40 AM
Saturday, May 3, 2014 2:22 AM
All replies
-
What URL are you trying to use? Are you sure it's valid?
Your code works fine in a test app pointing at your avatar here: http://social.microsoft.com/profile/u/avatar.jpg?displayname=teja510&size=extralarge&version=00000000-0000-0000-0000-000000000000
Friday, May 2, 2014 12:00 AMModerator -
Rob,
Im trying to use a public blob(Azure) url which will be of format http://XXX.blob.core.windows.net/Images/<<guid>>
The same kind of url is rendered for Live Tile. But it doesnot render for Toast Notification.
Thanks & Regards Tejaswi Chandrapatla
Friday, May 2, 2014 5:20 AM -
Can you share the actual URL?Friday, May 2, 2014 6:28 PMModerator
-
I could see them now.. I wonder it worked after restart of my machine and running the app again.
Thanks & Regards Tejaswi Chandrapatla
- Marked as answer by Anne Jing Friday, May 9, 2014 7:40 AM
Saturday, May 3, 2014 2:22 AM