Search code examples
c#urlwin-universal-applive-tile

Live Tile - UWP (Windows 10) - Url in source image not working


I try to put url on source of an image in XML of my LiveTyle Template, but certain urls do not work properly. I tested the App Notifications Visualizer by Microsoft and do not work, however put the link in the browser the image is returned. Any idea what is the problem?

Link does not work in the template:

Encode: http%3A%2F%2Fproxycache.app.iptv.telecom.pt%3A8080%2FMeoHandler%2FImageProxy.ashx%3Fwidth%3D200%26url%3D1%2F5%2F55046d06-98e0-4aa3-be7d-f6996152b8ad_c_anatomia-16x9.jpg

Decode: http://myimages.com/today/hello?width=200&url=9_c_xpto-16x9.jpg

both not working :(

Extract template:

string localImageURL = "ms-appx:///Assets/MyImage70x70.png"; 

XmlDocument _myXML = new XmlDocument(); 

string PeekSlide=
                      @"<tile>
                       <visual>
                      <binding template=""TileMedium"" branding=""name"">
                       <image src=""{0}""  placement=""peek"" hint-overlay=""20""/>
                      <image  src=""{1}"" placement=""background""/>
                      </binding>
                      </binding>
                      </visual>
                      </tile>";

    var _myTile = string.Format(PeekSlide, localImageURL, myWebUrl);
    _myXML.LoadXml(_myTile);

Thanks in advance!


Solution

  • This is because your ImageURL contains &, which has a specail meaning in XML. So XML cannot analysis your image Url. Replace & with &amp; instead. Details refrence the Entity References part . After replaced, your image Url should be

     <image src="http://myimages.com/today/hello?width=200&amp;url=9_c_xpto-16x9.jpg"/>