The icon in the taskbar is looking very ugly in my WPF application.
The designer sent me some PNGs like:
32x32, 64x64, 96x96, 128x128, 192x192, 256x256, 512x512
Make an .ico file containing multiple sizes. At a minimum, you should have the following sizes: 16x16, 32x32, 48x48, and 256x256 according to the Windows icon visual guidelines. Having a single .ico file will help Windows pick the best size and scale it appropriately depending on the situation (application icon, large taskbar, small taskbar, etc.)
If you aren't a designer, then it's also better to let your designer make the 16x16 image, since it's possible the larger images you have have too much detail and do not scale down very well. If the larger images are very detailed, then the designer could make the smaller images simpler so that the icon shows better. The visual guidelines linked above have more tips about this.
Taskbar icons seem to get blurry as soon as a 48x48 pixels version is included in the .ico file. Instead of picking the correctly sized 32x32 pixels version, for some reason Windows apparently picks the 48x48 one and scales it down.
The solution for me is to use two separate icon files:
Icon
property in XAML or Hannish's approach, be used for the titlebar and taskbar respectively - without unwanted scaling.Testing on Windows 10, this seems to cover the following display cases: taskbar, window titlebar, Alt-TAB menu, Desktop and file explorer.
I had the same problem, it was not working even with a multi-sized .ico file. Setting the icon directly in the Window resulted in a pixelated icon.
I managed to fix it with this code-behind 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.
}
Icon file is multi-sized, this worked for me in WPF - Windows 10.
You can convert your .png icon into a multi-sized .ico file here http://icoconvert.com/