0

I want my UWP app to provide the user with the opportunity to Pin/Unpin the app to the Start Screen by pressing a button.

I have managed to pin the app using this code:

AppListEntry entry = (await Package.Current.GetAppListEntriesAsync())[0];
bool isPinned = await StartScreenManager.GetDefault().RequestAddAppListEntryAsync(entry);

However, I could not find anywhere a way to unpin the app. Is the unpin functionality available for secondary tiles only?

Martin Zikmund
  • 38,440
  • 7
  • 70
  • 91
Cosmin
  • 33
  • 7

2 Answers2

2

No, it does not seem so. The StartScreenManager is the class that manages the primary app tiles and currently it only allows the user to pin the primary tile, not unpin it, in contrast to SecondaryTile which can be unpinned.

You can instruct the user how to unpin the tile manually only.

Martin Zikmund
  • 38,440
  • 7
  • 70
  • 91
  • 1
    Correct. The main use case of pinning the primary tile is when you're promoting to the user that you can pin the app. In that case, there's no need to unpin, since you would only show that if the user doesn't already have your app pinned. In your settings pages, you can instruct how to unpin manually like Martin said. If you have any further questions, I'm the owner of this API at Microsoft. Thanks! – Andrew Leader Jan 22 '18 at 17:29
  • That is very cool to know Andrew! Great work to you and whole Windows 10 team (or rather - Teams :-) )! UWP is great! – Martin Zikmund Jan 22 '18 at 17:33
1

Yes, it can.

PIN => bool x = await tile.RequestCreateAsync();

UNPIN => bool x = await tile.Request​Delete​Async();

Angel T
  • 182
  • 2
  • 7