Setting application icon in Explorer? Setting application icon in Explorer? wpf wpf

Setting application icon in Explorer?


Have you selected the icon for your application? (project properties > tab application > symbol and manifest > symbol)


The following example shows how to set a window icon.

By using XAML,

<Window  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"  x:Class="SDKSample.MainWindow"    Icon="WPFIcon1.ico"></Window>

By using c# code,

Uri iconUri = new Uri("pack://application:,,,/WPFIcon2.ico", UriKind.RelativeOrAbsolute);this.Icon = BitmapFrame.Create(iconUri);

By using VB,

Dim iconUri As New Uri("pack://application:,,,/WPFIcon2.ico", UriKind.RelativeOrAbsolute)Me.Icon = BitmapFrame.Create(iconUri)

For more info, refer this.


Make sure your .ico file contains the right selection of sizes so that the appropriate one displays in explorer.

For Windows you'll want:256 x 256 pixels, 48 x 48 pixels, 32 x 32 pixels and 16 x 16 pixels.

All 32bit (24bit colour, 8bit transparency).