locked
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

    Saturday, May 3, 2014 2:22 AM

All replies