Updating a live tile in its proper size?

后端 未结 2 496
南方客
南方客 2020-12-21 17:40

When updating live tiles in Windows 8, I don\'t know how to update the tile in both the \"large\" and \"small\" size at the same time.

I would like users who have my

2条回答
  •  醉梦人生
    2020-12-21 18:40

    The tile XML needs to be combined to look like this:

    
        
            
                01 
                Tue 
            
            
                 
                some text 
            
        
    
    

    Now there are many ways you can use to get your XML into this form, but my favourite way is to use the use the NotificationsExtensions library as it encapsulates the XML manipilation.

    Once you reference the library in your project your code should look like this:

    // create the wide template
    ITileWide310x150PeekImageAndText01 wideContent = TileContentFactory.CreateTileWide310x150PeekImageAndText01();
    wideContent.TextBodyWrap.Text = "some text";
    wideContent.Image.Src = "ms-appx:///Assets/WideLogo.png";
    
    // create the square template and attach it to the wide template 
    ITileSquare150x150Block squareContent = TileContentFactory.CreateTileSquare150x150Block();
    squareContent.TextBlock.Text = "01";
    squareContent.TextSubBlock.Text = "Tue";
    wideContent.Square150x150Content = squareContent;
    
    var tn = new TileNotification(wideContent.GetXml());
    TileUpdateManager.CreateTileUpdaterForApplication("App").Clear();
    TileUpdateManager.CreateTileUpdaterForApplication("App").Update(tn);
    

提交回复
热议问题