I am testing a basic secondary live tile(ShellTile) functionality with the code below. Creating the tile works fine but using the tile to navigate to the URI always works in debug mode but not when testing disconnected from the computer and I don't know why. I am testing with just 1 tile. Funny thing is, if I restart, secondary tile will work one more time after the restart. What am I missing?
1> This is the code behind that makes the secondary tile
string path = @"/Views/test.xaml?text=" + parameter.ToString();
StandardTileData tileData = new StandardTileData
{
Title = parameter.ToString(),
BackTitle = parameter.ToString(),
BackContent = parameter.ToString()
};
ShellTile.Create(new Uri(path, UriKind.Relative), tileData);
2.test.xaml code
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
string text= "";
text= NavigationContext.QueryString["text"];
}
Thanks, Jamie
When the Tile which NavigationUri is same with your parameter, the ShellTile.Create method will crash. You should check if the tile is exist first, like this:
You can choose Contains or Equals by your content. and then: