WPF icon for all application windows

You can set one icon so that it is used in each window of the current application. So I install it once (not on every window manually).?

+50
wpf window icons
Dec 10 '09 at 15:06
source share
5 answers

A good link to this topic is provided here by MSDN . Indicates that you have an icon for the application (desktop icon) and one for each window.

The WPF window always displays an icon. When one of them is not provided by setting the icon, WPF selects the icon to display based on the following rules:

  • Use the assembly icon if indicated.

  • If no assembly icon is specified, use the default Microsoft Windows icon.

Community Content Link:

"Lithium tip: if you install the application icon and expect to see it in the window, it will not be displayed if it is running in debugging from VS. Launching from the outside or without binding (ctrl + f5) the icon is displayed as expected."

+90
Dec 10 '09 at 15:12
source share

Set the icon in the project properties on the Application tab in the Resources section. This icon will be the default icon for all windows in the application.

+15
Dec 10 '09 at 15:17
source share

In VS2010, open “Properties” for the main executable application and open the “Application” tab. Set the icon in the "Icon and manifest" section of the "Resources" section.

To see the icon during debugging under VS2010, you need to open the "Debugging" tab and uncheck the "Enable Visual Studio hosting process", otherwise you will see only the default icon for most windows.

I assume that the icon loading code is confused by the hosting process and is looking in "someapplication.vshost.exe" instead of "someapplication.exe" for the icons.

This seems like a fix in VS2013.

+2
Feb 07 '14 at 19:12
source share

You can also try this to set your own icon:

private void Page_Loaded_1(object sender, RoutedEventArgs e) { Uri iconUri = new Uri(@"C:\Apps\R&D\WPFNavigation\WPFNavigation\Images\airport.ico", UriKind.RelativeOrAbsolute); (this.Parent as Window).Icon = BitmapFrame.Create(iconUri); } 
+2
Aug 19 '15 at 10:39 on
source share

The reason that “Enable Visual Studio Hosting” renders the icon inoperative is because it starts with vshost.exe and therefore the manifest is not read properly. The same thing happens if there are other things in the manifest, such as regfree ocx controls, etc., which require the manifest to load.

+1
Mar 16 '15 at 12:42
source share



All Articles