我正在创建一个Windows Phone应用程序,我在其中放置了一个按钮将应用程序固定到启动屏幕,但是当按住应用程序列表屏幕上的应用程序图标时,我发现可以使用固定启动选项
ShellTile TileToFind = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains("MainPage.xaml"));
// Create the Tile if we didn't find that it already exists.
if (TileToFind == null)
{
// Create the Tile object and set some initial properties for the Tile.
// The Count value of 12 shows the number 12 on the front of the Tile. Valid values are 1-99.
// A Count value of 0 indicates that the Count should not be displayed.
StandardTileData NewTileData = new StandardTileData
{
BackgroundImage = new Uri("300.png", UriKind.Relative),
Title = "apptitle",
BackTitle = "title",
BackContent = "testing ",
BackBackgroundImage = null
};
// Create the Tile and pin it to Start. This will cause a navigation to Start and a deactivation of our app.
ShellTile.Create(new Uri("/MainPage.xaml", UriKind.Relative), NewTileData);
}
else {
MessageBox.Show("Already Pinned");
}
如何禁止用户从应用程序列表屏幕再次固定应用程序
最佳答案
您应该了解主要图 block 和次要图 block 之间的区别。您通过代码创建的内容是辅助图 block ,用户从上下文菜单中固定的内容是主图 block 。
主图 block 始终是第一个图 block :
var primaryTile = ShellTile.ActiveTiles.First();
请记住,主图 block 始终存在,即使它没有固定。没有 API 可以检查主图 block 的固定状态。因此,我建议您从应用中删除此功能。
还可以找到一些详细信息here .
关于c# - 使用 C# 通过代码固定应用程序时,在应用程序列表页面上停用 ' pin to start '?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19756239/