Reputation: 757
I have a Windows 8 app that generates a Secondary Tile with the following code:-
var itemId = globalId;
var itemTitle = Constants.getName(itemId);
var itemImg = Constants.getImage(itemId);
var itemImage = new Uri(itemImg);
var tile = new SecondaryTile(
itemId,
"App Name: " + itemTitle,
"App Name: " + itemTitle,
itemId,
TileOptions.ShowNameOnLogo | TileOptions.ShowNameOnWideLogo,
itemImage,
itemImage
);
tile.VisualElements.ForegroundText = ForegroundText.Light;
bool pinned = await tile.RequestCreateForSelectionAsync(GetElementRectangle(sender as FrameworkElement), Placement.Below);
The code correctly executes, and itemImage gives something like: {ms-appx:///Images/img1.png}. However, while the size of the tile, name of the tile, and arguments are correctly generated, the tile is generated without an image and displays the default grey.
This works in one of my other apps, so I can't figure out why it's not working in here. The image even loads correctly outside of the pin to start dialog as it's used elsewhere in the app.
It's definitely included in the project and build action is set to content.
Any ideas?
Upvotes: 1
Views: 186
Reputation: 173
You cannot simply use Uri, just replace " var itemImage = new Uri(itemImg);" with "var itemImage=new Windows.Foundation.Uri("ms-appx:///put the path to the image here.");"
Upvotes: 1