开发者

whereshould i put this code for creating a tile

开发者_Python百科i want to set secondry tile in my app but i don't know where i put code of secondry tile because it show unhandled exception and my App does not run it back

var foundTile = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains("DetailId=123"));

if (foundTile == null)
{
    var secondaryTile = new StandardTileData
    {
        BackgroundImage = new Uri("Images/SecondaryTileFrontIcon.jpg", UriKind.Relative),
        Title = "hiiiiiiii",
        Count = null,
        BackTitle = "",
        BackContent = "byeeeee ",
        BackBackgroundImage = new Uri("Images/ApplicationTileIcon.jpg", UriKind.Relative)
    };

    ShellTile.Create(new Uri("/Views/DetailsPage.xaml?DetailId=123", UriKind.Relative), secondaryTile);
} 


Each tile is identified by the Uri supplied to ShellTile.Create. In your case, you're not creating a secondary tile, but checking if the same tile already exists, and if it's not, then you create it.

If you want more than one tile, you need to use different uri's for the ShellTile.Create call, typically with different query-string parameters/values.

And you obviously shouldn't make it dependant on the uri of completely unrelated tile.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜