Wp8.1的实时图块模板 [英] live tile template for Wp8.1

查看:69
本文介绍了Wp8.1的实时图块模板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我正在尝试使用实时图块构建一个通用应用程序,我正面临着实时图块模板的问题。我正在为桌面应用程序获取此实时磁贴(这是正确的)

Hi everybody, I'm trying to build a universal app with live tiles and I'm facing a problem with the live tiles templates. I'm getting this live tile for the desktop app (which is correct)

 

并且从手机应用程序中的相同代码我得到了这个。虽然我使用相同的模板,但看起来文本是错误的。

and from the same code in the phone app I'm getting this. It looks like the texts are misplaced although I use the same template.

台式机和手机应用程序都在调用相同的后台任务。这是代码

Both, desktop and phone apps are calling the same background task. This is the code

var updater = TileUpdateManager.CreateTileUpdaterForApplication();
            updater.EnableNotificationQueue(true);
            updater.Clear();

            FormatStringsForLiveTiles();

            for (int i = 0; i < 2; i++)
            {
                XmlDocument wideTile = TileUpdateManager.GetTemplateContent(TileTemplateType.TileWide310x150BlockAndText02);
                XmlNodeList wideTileTextAttributes = wideTile.GetElementsByTagName("text");
                wideTileTextAttributes[0].InnerText = liveTileNames[i];
                wideTileTextAttributes[1].InnerText = DateTime.Now.AddDays(i).Day.ToString();
                wideTileTextAttributes[2].InnerText = String.Format("{0:MMMM}", DateTime.Now.AddDays(i));

                XmlDocument squareTile = TileUpdateManager.GetTemplateContent(TileTemplateType.TileSquare150x150Text04);
                XmlNodeList squareTileTextAttributes = squareTile.GetElementsByTagName("text");
                squareTileTextAttributes[0].InnerText = liveTileNames[i];                

                updater.Update(new TileNotification(wideTile));
                updater.Update(new TileNotification(squareTile));                
            }            
            XmlDocument largeTile = TileUpdateManager.GetTemplateContent(TileTemplateType.TileSquare310x310TextList03);
            XmlNodeList largeTileTextAttributes = largeTile.GetElementsByTagName("text");
            largeTileTextAttributes[0].InnerText = "Σήμερα γιορτάζουν";
            largeTileTextAttributes[1].InnerText = liveTileNames[0];
            largeTileTextAttributes[2].InnerText = "Αύριο γιορτάζουν";
            largeTileTextAttributes[3].InnerText = liveTileNames[1];
            largeTileTextAttributes[5].InnerText=String.Format("{0:dddd dd MMMM}",DateTime.Now);
            updater.Update(new TileNotification(largeTile));

            XmlDocument badgeXml = BadgeUpdateManager.GetTemplateContent(BadgeTemplateType.BadgeNumber);
            XmlElement badgeElement = (XmlElement)badgeXml.SelectSingleNode("/badge");
            badgeElement.SetAttribute("value", badgeCounter);
            BadgeNotification badge = new BadgeNotification(badgeXml);
            BadgeUpdateManager.CreateBadgeUpdaterForApplication().Update(badge);

            defferal.Complete();            Pleas


请有人帮忙吗?我真的坚持这个。


Please anybody can help? I'm really stuck on this.

推荐答案

了解如何在平铺模板目录中显示此平铺模板这似乎是预期的行为。 WP和Win8.1上的相同模板不会呈现相同的内容,请参阅:

http://msdn.microsoft.com/en-us/library/windows/apps/Hh761491.aspx#TileWideBlockAndText02
Going by how this tile template is shown in the Tile Template Catalog this seems to be the expected behavior. The same template doesn't render the same on WP and Win8.1, see: http://msdn.microsoft.com/en-us/library/windows/apps/Hh761491.aspx#TileWideBlockAndText02


这篇关于Wp8.1的实时图块模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆