2

Windows 8 でライブ タイルを更新する場合、「大」サイズと「小」サイズのタイルを同時に更新する方法がわかりません。

アプリを小さいモードでピン留めしているユーザーには、プログラムで表示できるアイテムの数を知ってもらいたいです。また、アプリを大きいモードでピン留めしているユーザーには、両方といくつかのサンプル アイテム タイトルも表示します。

しかし、何をしても、タイルの更新が 1 つしか届かないようです。小さいタイルまたは大きいタイルを持っている人が失望しないように、タイルのサイズに基づいてタイルの更新を配信するにはどうすればよいですか?

4

2 に答える 2

5

正方形と幅広の両方のタイル形式のコンテンツは、各タイル通知を定義するXMLに含めることができます(含める必要があります)。要素の下に、visual2つの要素を追加するだけbindingです。1つは幅の広いタイルテンプレートを使用し、もう1つは正方形のタイルテンプレートを使用します。

<tile>
    <visual lang="en-US">
        <binding template="TileWideText03">
            <text id="1">Hello World!</text>
        </binding>
        <binding template="TileSquareText04">
            <text id="1">Hello World!</text>
        </binding>
    </visual>
</tile>

NotificationsExtensionsライブラリ(MSDNタイルサンプルにあります)は、XMLを簡単に操作し、正方形と幅の広いタイルコンテンツを組み合わせるためのオブジェクトモデルを提供します。

// create the wide template 
ITileWideText03 tileContent = TileContentFactory.CreateTileWideText03(); 
tileContent.TextHeadingWrap.Text = "Hello World!"; 

// create the square template and attach it to the wide template 
ITileSquareText04 squareContent = TileContentFactory.CreateTileSquareText04(); 
squareContent.TextBodyWrap.Text = "Hello World!"; 
tileContent.SquareContent = squareContent; 
于 2012-09-26T15:53:02.607 に答える
1

タイル XML を次のように組み合わせる必要があります。

<tile>
    <visual version="3">
        <binding template="TileSquare150x150Block" fallback="TileSquareBlock">
            <text id="1">01</text> 
            <text id="2">Tue</text> 
        </binding>
        <binding template="TileWide310x150PeekImageAndText01" fallback="TileWidePeekImageAndText01">
            <image id="1" src="ms-appx:///Assets/WideLogo.png" /> 
            <text id="1">some text</text> 
        </binding>
    </visual>
</tile>

XML をこの形式にするために使用できる方法は多数ありますが、私のお気に入りの方法は、XML 操作をカプセル化するNotificationsExtensions ライブラリを使用することです。

プロジェクトでライブラリを参照すると、コードは次のようになります。

// 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);
于 2015-08-04T10:53:11.340 に答える