Pinning Multiple Secondary Tiles to Start RRS feed

  • Question

  • I am trying to allow users to pin more than one secondary tile to the start screen. As of now, the current secondary tile is overwritten by the new one, which means I do not have a unique ID for each tile. How do I go about doing this?
    Saturday, March 9, 2013 4:31 AM


  • Hi jflintstone81,

    When you creating a new Windows.UI.StartScreen.SecondaryTile object, the first constructor parameter is a tile id, and you can pass a unique value for it so that new tile you create won't overwrite previous ones. Here is a simple example on this:

    function pinCustomSecondaryTile() {
            var tileId = "customTile" + new Date().getTime();
            var uriLogo = new Windows.Foundation.Uri("ms-appx:///images/SecondaryTileDefault-sdk.png");
            var uriSmallLogo = new Windows.Foundation.Uri("ms-appx:///images/smallLogoSecondaryTile-sdk.png");
            var tile = new Windows.UI.StartScreen.SecondaryTile(
                "My Custom Tile",
                "Name of Tile shown",
                "Custom Tile: " + tileId,
            tile.foregroundText = Windows.UI.StartScreen.ForegroundText.dark;
            tile.smallLogo = uriSmallLogo;
            var selectionRect = document.getElementById("pinButton").getBoundingClientRect();
            tile.requestCreateForSelectionAsync({ x: selectionRect.left, y: selectionRect.top, width: selectionRect.width, height: selectionRect.height }, Windows.UI.Popups.Placement.below).done(function (isCreated) {
                if (isCreated) {
                    // The tile was successfully created, so we'll display a status message
                    WinJS.log && WinJS.log("Secondary tile was successfully pinned.", "sample", "status");
                } else {
                    // something happened - either the user cancelled, or an error was encountered.
                    // Either way, the flyout is now gone, and we'll react the same way.
                    WinJS.log && WinJS.log("Secondary tile was not pinned.", "sample", "error");

    the code is modified according to the following Secondary tiles SDK sample:

    #Secondary tiles sample

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Song Tian Friday, March 15, 2013 9:26 AM
    Monday, March 11, 2013 3:27 AM