How to handle SecondaryTile click event in windows apps

178 Views Asked by At

Present i am working with SecondaryTile, i want to fire an event when tile is clicked, is there any possibility for that please help me..

Here is my code,

SecondaryTile initialData = new SecondaryTile();          
            initialData = new SecondaryTile(
                ShowID,
                ojsShow.Title,
                "NoArguments",
                new Uri("ms-appx:///Images/" + ojsShow.TileImage),
                TileSize.Square150x150);
            initialData.VisualElements.ShowNameOnSquare150x150Logo = true;

 await initialData.RequestCreateAsync();
2

There are 2 best solutions below

0
On BEST ANSWER

In app.xaml you can find whether clicked title or not

protected override void OnActivated(IActivatedEventArgs args)
{
  var data= e.TileId;
  if(data=="App")
   {
     //code for normal app start...
   }
   else
   {
    //code for tile click..
    //you can see the tile in data parameter
   }
}
2
On

The only thing you can do is to open the app and send some parameters to take action/ handle it..

for the SecondaryTile, I believe you can set the page/ parameters by your new instance ..

for the handling process, you can override the OnActivated event and check the parameters and the page:

protected override void OnActivated(IActivatedEventArgs args)