question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Change taskbar icon at runtime on deployed app

See original GitHub issue

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:

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.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:21 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
cregxcommented, Apr 15, 2021

I think that it is a bug. I tried @musli’s idea, creating a runner.exe that runs the real application. As of now, changing the application icon in the taskbar under the following conditions has worked.

  1. if I call the runner.exe directly from the program directory.
  2. or if I pin a shortcut to the runner.exe in the start (pin to start).

But now it gets interesting: If I pin the original exe in addition to the pinned runner.exe in the startup, then the change of the application icon in the taskbar does not work anymore.

So, in my opinion, the problem is related to Windows’ own shortcut management.

1reaction
muslicommented, Apr 29, 2021

@563203132 @lindexi Maybe there’s a problem with your packaging, and I created a wix SetupProject that uses it to compile a .msi installation package, and the program that runs out doesn’t have that problem There’s also a small finding that your problem won’t exist when the taskbar doesn’t merge icons (from Quicker of master) Demo.zip

Read more comments on GitHub >

github_iconTop Results From Across the Web

Change taskbar icon at runtime on deployed app
In your project expand the Properties and doubleclick Resources.resx then you can hit Add Resource -> Add Existing File and add your Icons....
Read more >
[Solved] Change icon displayed in taskbar at runtime
In code I am simply changing the Form.Icon property and this works no problem if I run the app from the EXE. The...
Read more >
How to change the app icon displayed at the windows ...
How to change the app icon displayed at the windows taskbar during runtime? If this is your first visit, be sure to check...
Read more >
how to change compiled app icon (using app designer) on ...
I have MatLab ver 2021b. You can change the default ICON like shown in this picture.
Read more >
How to change taskbar icon during runtime on windows
Hi all, I've created a Qt application to talk with a remote device and I want to change the taskbar icon to show...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found