microsoft / microsoft/WindowsAppSDK
Taskbar badge does not show until the app window closed
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 4.7k
- Forks
- 471
- Avg merge
- 3d 13h
- Merged PRs (30d)
- 28
Description
### Describe the bug
I am using `Windows.UI.Notification.BadgeUpdateManager` api to add a badge to taskbar icon for a winui3 app, the badge does not appear in the taskbar icon until the window is closed. And it will disappear after it launches. In short, it seems that a winui3 app cannot show the badge when the app window is running.
**For UWP app however, badge will appear as soon as the function is called.**
### Steps to reproduce the bug
1. Use following code
```cpp
inline auto MakeBadgeNotification(wchar_t const* glyph)
{
auto xml = winrt::Windows::UI::Notifications::BadgeUpdateManager::GetTemplateContent(
winrt::Windows::UI::Notifications::BadgeTemplateType::BadgeGlyph
);
xml.SelectSingleNode(L"/badge")
.as()
.SetAttribute(L"value", glyph);
return winrt::Windows::UI::Notifications::BadgeNotification{ xml };
}
inline auto MakeBadgeNotification(int value)
{
auto xml = winrt::Windows::UI::Notifications::BadgeUpdateManager::GetTemplateContent(
winrt::Windows::UI::Notifications::BadgeTemplateType::BadgeNumber
);
xml.SelectSingleNode(L"/badge")
.as()
.SetAttribute(L"value", winrt::to_hstring(value));
return winrt::Windows::UI::Notifications::BadgeNotification{ xml };
}
winrt::Windows::UI::Notifications::BadgeUpdateManager::CreateBadgeUpdaterForApplication().Update(MakeBadgeNotification(1)); //number badge
winrt::Windows::UI::Notifications::BadgeUpdateManager::CreateBadgeUpdaterForApplication().Update(MakeBadgeNotification(L"alert")); //glyph badge
```
2. Badge only appears in start menu, not in taskbar
3. Close the app, the taskbar pinned icon now has badge.
### Expected behavior
_No response_
### Screenshots
This is Winui3 app

After closing the window:

This is UWP app

### NuGet package version
Windows App SDK 1.4.2: 1.4.231008000
### Packaging type
Packaged (MSIX)
### Windows version
Windows 10 version 1809 (17763, October 2018 Update)
### IDE
_No response_
### Additional context
_No response_
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the packaged WinUI 3 behavior with the shown MakeBadgeNotification code and BadgeUpdateManager APIs on the reported Windows and Windows App SDK versions. Compare taskbar and Start menu behavior with the UWP case, then trace the Windows App SDK notification integration to identify where live taskbar updates diverge. Done means badges appear while the WinUI 3 window is running and do not disappear after launch.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100