Search code examples
c#windowswindows-runtimewindows-10-universalwindows-8.1-universal

How to handle SecondaryTile click event in windows apps


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();

Solution

  • 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
       }
    }