Search code examples
windows-phone-8.1microsoft-band

Having an issue with custom page content not showing in the band tile


I'm having an issue with bandClient.TileManager.SetPagesAsync its returning true which I assume means everything was successful but when I click on my band tile nothing is displayed. I left out the tile creation code below, since I believe that works fine as I'm able to send message to it successfully. Any ideas?

private void CreateLeaderboardPageLayout(BandTile tile)
    {
        // create a scrollable vertical panel that will hold 3 text messages
        ScrollFlowPanel panel = new ScrollFlowPanel
        {
            Rect = new PageRect(0, 0, 245, 102),
            Orientation = FlowPanelOrientation.Vertical
        };

        // add the text block to contain the first message
        panel.Elements.Add(new TextBlock 
        {
            ElementId = (short) TileMessagesLayoutElementId.Message1,
            Rect = new PageRect(0, 0, 245, 102),
            // left, top, right, bottom margins
            Margins = new Margins(15, 0, 15, 0),
            Color = new BandColor(0xFF, 0xFF, 0xFF)
        });

        // add the text block to contain the second message
        panel.Elements.Add(new TextBlock
        {
            ElementId = (short)TileMessagesLayoutElementId.Message2,
            Rect = new PageRect(0, 0, 245, 102),
            // left, top, right, bottom margins
            Margins = new Margins (15, 0, 15, 0),
            Color = new BandColor(0xFF, 0xFF, 0xFF)
        });

        // add the text block to contain the third message
        panel.Elements.Add(new TextBlock
        {
            ElementId = (short)TileMessagesLayoutElementId.Message3,
            Rect = new PageRect(0, 0, 245, 102),
            // left, top, right, bottom margins
            Margins = new Margins(15, 0, 15, 0),
            Color = new BandColor(0xFF, 0xFF, 0xFF)
        });

        // create the page layout
        var layout = new PageLayout(panel);


        tile.PageLayouts.Add(layout);
    }

    public async Task UpdateLeaderBoard(IBandClient bandClient)
    {
        // create the object containing the page content to be set
        var pageContent = new PageData(MSC_LEADERBOARD_GUID, 0,
            new TextBlockData((Int16) TileMessagesLayoutElementId.Message1,
                "This is the text of the first message"),
            new TextBlockData((Int16) TileMessagesLayoutElementId.Message2,
                "This is the text of the second message")
            ,
            new TextBlockData((Int16) TileMessagesLayoutElementId.Message3,
                "This is the text of the third message")
            );
        var added = await bandClient.TileManager.SetPagesAsync(MSC_TILE_GUID, pageContent);
    }

Solution

  • There is a limit of at most one TextBlock / WrappedTextBlock per page having a string with more than 20 characters. Try reducing the number of characters in the page data TextBlock strings and see if that helps.