Users who love our app may appreciate a way to pin it to the system taskbar directly from the app UI. Universal Windows Platform has an API just for that and even better – it does work with the upcoming Windows 10X as well!
To get access to the API, we first need to check for its presence. TaskbarManager
is available since Windows 10 version 16299, so if we want to support earlier versions as well, we should use ApiInformation
to verify first:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (ApiInformation.IsTypePresent("Windows.UI.Shell.TaskbarManager")) | |
{ | |
// TaskbarManager is available | |
// … | |
} |
When we know TaskbarManager
is available, we can retrieve its instance using the GetDefault()
method:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var taskbarManager = TaskbarManager.GetDefault(); |
Some SKUs of Windows 10 don’t have a taskbar (for example Xbox), so first need to verify that:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (taskbarManager.IsSupported) | |
{ | |
// taskbar is supported | |
// … | |
} |
To avoid showing the dialog unnecessarily, we should first check if the application is already pinned:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var isPinned = await taskbarManager.IsCurrentAppPinnedAsync(); | |
if (!isPinned) | |
{ | |
// oh, app is not pinned yet! | |
// … | |
} |
Almost there, just one final check! The TaskbarManager.IsPinningAllowed
allows us to check if app pinning is allowed on the device, as organization can block it for work accounts using group policy (however weird a reason for that might be 🤗):
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (taskbarManager.IsPinningAllowed) | |
{ | |
// we are ready to pin! | |
// … | |
} |
Now we can finally safely request to pin our app to the taskbar! We can call the asynchronous RequestPinCurrentAppAsync
method which returns a bool
value indicating if the user accepted the request and pinned the app:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var pinned = await taskbarManager.RequestPinCurrentAppAsync(); |
The cool thing about this all is that it works on Windows 10X, too!

Source code
The example source code and sample app for this article is available here on my GitHub.
Summary
The taskbar was always one of the most important shell components in Windows. With tiles apparently going away in Windows 10X, it is worth adding the ability to pin our app to the taskbar to help users to open it quickly and easily.
Good tutorial. Can you provide an tutorial about how to use systray with UWP? Thank’s