【问题标题】:SecondaryTile.DisplayName not getting updatedSecondaryTile.DisplayName 未更新
【发布时间】:2021-08-19 02:24:48
【问题描述】:

我有以下代码,它应该更新 SecondaryTile 的文本。

async Task UpdateTile(SecondaryTile tile, string text)
{
    tile.DisplayName = text;
    await tile.UpdateAsync();
}

此代码确实在我创建磁贴时起作用。但后来当我在检索它后尝试更新它时:

SecondaryTile tile = new SecondaryTile(id);

它不再起作用了,尽管更新同一个图块的视觉效果的类似方法确实起作用了。所以我知道我有正确的瓷砖。

【问题讨论】:

    标签: c# .net uwp win-universal-app desktop-bridge


    【解决方案1】:

    我已经测试过了,代码运行良好。可以参考以下代码。

    如下:

    // Initialize a secondary tile with the same tile ID you want to update
    SecondaryTile tile = new SecondaryTile(tileId);
    tile.DisplayName = "xxx";
    // Show the display name on all sizes
    tile.VisualElements.ShowNameOnSquare150x150Logo = true;
    tile.VisualElements.ShowNameOnWide310x150Logo = true;
    tile.VisualElements.ShowNameOnSquare310x310Logo = true;
    await tile.UpdateAsync();
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-03-09
      • 1970-01-01
      • 2021-10-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-09-01
      相关资源
      最近更新 更多