首先,你要在应用清单指定锁定屏幕通知为徽章和磁贴文本;
然后需要用户在设置=>个性化=>锁屏界面(
ms-settings:lockscreen )中将“选择显示详细状态的应用”设置为你的应用;
最后,发送磁贴更新,将要显示的内容发送过去。
你可以安装NotificationsExtensions NuGet 程序包,使用如下代码去更新
TileContent c = new TileContent
{
Visual = new TileVisual
{
LockDetailedStatus1 = "line1",
LockDetailedStatus2 = "line2",
LockDetailedStatus3 = "line3",
TileWide = new TileBinding()
{
}
}
};
TileUpdateManager.CreateTileUpdaterForApplication().Update(new TileNotification(c.GetXml()));