dotnet / dotnet/wpf

Change taskbar icon at runtime on deployed app

Open
#3,590 21 comments 0 reactions 0 assignees View on GitHub
Needs minimal repro project
Dominant language
C#
Stars
7.7k
Forks
1.3k
Avg merge
1d 11h
Merged PRs (30d)
61

Description

I would like to change taskbar icon to identity what type the current app is, so I set a default icon for the app and the icon will be changed according to the type returned from server when the app is launching.

I just change the icon like this:

```csharp
Application.Current.MainWindow.Icon = new BitmapImage(new Uri(string.Format("AppLogos/{0}.ico", terminal.TerminalType.Name), UriKind.Relative));
```

It's working well on Visual Studio but I found out that it's not changing my task bar on deployed app (Install the app using a MSI file).

So is there a way to do it?

**UPDATE**

To force the icon refresh on my deployed app I have to pin/unpin my icon taskbar, unfortunately this is a user command only so I can't do this in wpf programmatically.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.