ここの例から始めて、複数のタイルをスタート画面にピン留めするアプリを作成しました。最初のタイルをピン留めすると、問題はありません。ただし、(アプリ リストまたは戻るキーを使用して) アプリに戻り、2 番目の画像をクリックして 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);
}
誰が何が起こっているのか教えてもらえますか? ご覧いただきありがとうございます