fipcurren88
fipcurren88

Reputation: 701

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!

Upvotes: 1

Views: 847

Answers (2)

Sunteen Wu
Sunteen Wu

Reputation: 10627

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"/>

Upvotes: 1

Thomas LEBRUN
Thomas LEBRUN

Reputation: 436

The content of the field '_myTile ' will be a XML with the path to an image on the assets, not from the Web.

Why you don't try this:

string localImageURL = "http://proxycache.app.iptv.telecom.pt:8080/MeoHandler/ImageProxy.ashx?width=200&url=1/5/55046d06-98e0-4aa3-be7d-f6996152b8ad_c_anatomia-16x9.jpg"; 

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);
_myXML.LoadXml(_myTile);

HTH,

Thomas

Upvotes: -1

Related Questions