2

这里的示例开始,我创建了一个应用程序来将多个磁贴固定到“开始”屏幕。当我固定第一块瓷砖时,我没有任何问题。但是,当我返回应用程序(通过应用程序列表或返回键)并单击第二个图像以固定第二个磁贴时,我得到一个 InvalidOperationException。

这是我的简单代码:

    private void Pin_Tile1(object sender, RoutedEventArgs e)
    {
        StandardTileData data1 = new StandardTileData
        {
            BackgroundImage = new Uri("Assets/tile1.png", UriKind.Relative),
            Title = "Tile 1",
            BackContent = "asdf"
        };

        ShellTile.Create(new Uri("/MainPage.xaml", UriKind.Relative), data1);
    }

    private void Pin_Tile2(object sender, RoutedEventArgs e)
    {
        StandardTileData data20 = new StandardTileData
        {
            BackgroundImage = new Uri("Assets/tile2.png", UriKind.Relative),
            Title = "Tile 2",
            BackContent = "fdsa"
        };
        ShellTile.Create(new Uri("/MainPage.xaml", UriKind.Relative), data2); 

    }

谁能告诉我发生了什么?感谢您的关注

4

1 回答 1

1

这里开始,每个活动图块都必须指向一个唯一的 Uri,这就是我搞砸的地方。

要求的完整列表是:

  • 每个动态磁贴必须指向一个唯一的 URI 位置。
  • Each time that you create a secondary tile, the user will be taken to their home screen to view it. You can’t create more than one secondary tile at a time.
  • Limit the number of secondary live tiles allowed.
于 2012-11-25T04:43:21.700 回答