简体   繁体   中英

Windows Phone 7 - Custom Tile support

I'm looking to create an app that has a secondary tile that when pressed, runs some code and then exits out to the start screen, much like 'Stop The Music!' where you can pin a quick-stop tile to tap and instantly stop any audio media playing. I am certain this works on WP8 applications as the feature works perfectly on my Lumia 820 however I am unsure if there is a way to do it for WP7 and I am also struggling to find any tutorials/papers explaining how it works or how to do it.

The tile won't be a live tile feeding back information but rather a short cut to a feature in the app, can anyone point me towards a clear explanation/tutorial or explain themselves please?

You could use the following code:

StandardTileData tileData = new StandardTileData
    {
        Title = "Secondary Tile",
        BackgroundImage = new Uri("/image.png", UriKind.Relative),
        Count = 5,
        BackTitle = "Secondary Tile",
        BackBackgroundImage = new Uri("", UriKind.Relative),
        BackContent = "Secondary tile sample"
    };

    // having a unique NavigationUri is necessary for distinguishing this tile
    string tileUri = "/MainPage.xaml?id=1";
    ShellTile.Create(new Uri(tileUri, UriKind.Relative), tileData);

Note that you can only create a secondary tile in reaction to a user event.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM