Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
492 views
in Technique[技术] by (71.8m points)

c# - Updating a live tile in its proper size?

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 app pinned in small mode to know how many items that are available in my program for viewing, and users who have my app pinned in large mode have both that, and some sample item titles too.

However, no matter what I do, it seems that only one of the tile updates arrive. How can I deliver a tile update based on the size of my tile, so that people who have either the small or large one won't be disappointed?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Content for both the square and wide tile format can (and should) be included in the XML defining each tile notification. Under the visual element, simply add two binding elements: one using a wide tile template, and one using a square tile template.

<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>

The NotificationsExtensions library (found in the MSDN tiles sample) provides an object model to easily manipulate the XML and combine square and wide tile content:

// 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; 

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...