C# SecondaryTile.DisplayName未更新

C# SecondaryTile.DisplayName未更新,c#,.net,uwp,win-universal-app,desktop-bridge,C#,.net,Uwp,Win Universal App,Desktop Bridge,我有以下代码,它应该更新SecondaryTile的文本 async Task UpdateTile(SecondaryTile tile, string text) { tile.DisplayName = text; await tile.UpdateAsync(); } 当我创建平铺时,此代码确实有效。但稍后,当我尝试在检索后使用以下内容更新它时: SecondaryTile tile = new SecondaryTile(id); 它不再起作用了,尽管一种类似的方法

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

async Task UpdateTile(SecondaryTile tile, string text)
{
    tile.DisplayName = text;
    await tile.UpdateAsync();
}
当我创建平铺时,此代码确实有效。但稍后,当我尝试在检索后使用以下内容更新它时:

SecondaryTile tile = new SecondaryTile(id);

它不再起作用了,尽管一种类似的方法可以更新相同的磁贴的视觉效果。所以我知道我有正确的磁贴。

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

详情如下:

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