【问题标题】:Is it possible to update Secondary Tile's DisplayName?是否可以更新 Secondary Tile 的 DisplayName?
【发布时间】:2015-07-22 14:59:35
【问题描述】:

我有一个这样创建的辅助磁贴:

SecondaryTile tileData = new SecondaryTile() { TileId = "MyId", DisplayName = "MyOldName", Arguments = "none" };
tileData.VisualElements.Square150x150Logo = new Uri(MediumImage);
tileData.VisualElements.ShowNameOnSquare150x150Logo = true;
return await tileData.RequestCreateAsync();

磁贴已成功创建,我可以看到它的DisplayName。现在当我想更新图像时,可以通过 TileUpdater 来完成:

TileUpdater tileUpdater = TileUpdateManager.CreateTileUpdaterForSecondaryTile("MyId");
var tileXml = TileUpdateManager.GetTemplateContent(TileTemplateType.TileSquare150x150Image);
// ... and so on

但是 DisplayName 怎么样 - 查看 tile template catalog 时,没有可用于更改磁贴的 DisplayName - 有可能吗? p>

【问题讨论】:

  • 您找到解决方案了吗?

标签: c# windows-runtime windows-phone-8.1


【解决方案1】:

在 Windows 10(可能也适用于 Windows Phone 8.1)中,您可以使用 AsyncUpdate

_secondaryTile.DisplayName = newDisplayName;
await _secondaryTile.UpdateAsync();

【讨论】:

  • 嗯,您链接的 MSDN 说:此方法不会更新这些属性:DisplayName...。你试过这个吗?
  • 这很奇怪。是的,我试过了,它对我有用:)
  • 也许他们在没有改变文档的情况下改变了一些东西,我会在接下来的几天里试试这个。
【解决方案2】:

很有可能:

//change main name (DisplayName)
var tiles = await SecondaryTile.FindAllAsync();
foreach (var tile in tiles)
{
    tile.DisplayName = localtime2;
    tile.UpdateAsync();
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-07-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-02-11
    • 2016-09-13
    相关资源
    最近更新 更多