Invalid taskbar icon in WPF application

The taskbar icon looks very ugly in my WPF application.

The designer sent me a few PNGs, for example:

32x32, 64x64, 96x96, 128x128, 192x192, 256x256, 512x512.

What do I need to do to get a goodloking taskbar icon?

Thanks!

+7
source share
3 answers

Create a .ico file containing several sizes. At a minimum, you should have the following sizes: 16x16, 32x32, 48x48, and 256x256 according to the icons for the Windows icons . Having one .ico file will help Windows choose the best size and scale it accordingly depending on the situation (application icon, large taskbar, small taskbar, etc.).

If you are not a designer, then it’s also better to let the designer make a 16x16 image, as it is possible that large images have too many details and they do not scale very well. If large images are very detailed, a designer can make smaller images easier to make the icon appear better. The visual guidelines above provide more tips on this.

+11
source

I had the same problem, it didn’t even work with the multi-sized .ico file. Setting the icon directly in the window led to the appearance of the icon.

I managed to fix this with this code for the application window:

private void Window_Loaded(object sender, RoutedEventArgs e) { Uri iconUri = new Uri("pack://application:,,,/Images/myicon.ico", UriKind.RelativeOrAbsolute); //make sure your path is correct, and the icon set as Resource this.Icon = BitmapFrame.Create(iconUri, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.OnLoad); //etc. } 

The icon file is multidimensional, it worked for me in WPF - Windows 10.

You can convert your .png icon to a multidimensional .ico file here http://icoconvert.com/

+4
source

The taskbar icons appear blurry as soon as a 48x48 pixel version is added to the .ico file. Instead of choosing the correct 32x32 pixel version, for some reason, Windows seems to select 48x48 and scale it.

The solution for me is to use two separate icon files:

  • One .ico containing 24x24 and 32x32 icon versions that will be set as the window icon using the Icon property in the XAML or Hannish approach will be used for the title and taskbar, respectively - without undesired scaling.
  • A second icon file containing - depending on which sources are correct - a size range from 16x16 to 256x256 pixels. Setting this as the application icon in the project properties will make the icon look good in all other places, such as the desktop and file explorer, in different viewing settings.

Testing in Windows 10 seems to cover the following storefronts: taskbar, window title, Alt-TAB menu, desktop, and file explorer.

+2
source