tags:

views:

632

answers:

2

It is possible to set one Icon so, that it would be used on every window in current app. So that i set it once (not on every window by hand)..?

+10  A: 

A good reference on the subject is here MSDN. States that you have an Icon for the Application (Desktop Icon), and one for each Window.

A WPF window always displays an icon. When one is not provided by setting Icon, WPF chooses an icon to display based on the following rules:

  1. Use the assembly icon, if specified.

  2. If the assembly icon is not specified, use the default Microsoft Windows icon.

Community Content Reference:

"A liitle tip : if you set the application icon and expect to see it on the window - it wont show up if running in debug from VS. Running externally or without attaching (ctrl + f5) the icon displays as expected."

jsmith
One thing to be aware of (and it is mentioned in the "community content" section of the MSDN article you reference) is that the app still defaults to the default Windows icon when you run in debug mode from Visual Studio. This may be fixed in VS 2010, but I haven't checked. Just don't be too confused if you don't see your icon showing up when you debug!
Skinniest Man
Good point, I'll update
jsmith
So how to specify then the icon in the assembly?
Vytas999
John let you know how to set the Assembly Icon. It's on the "Application" tab. You are probably running it in debug mode, which it will still show Windows Default Icon in debug. Build and run the executable from your bin folder. You should see the App Icon on all Windows.
jsmith
Ok, i compiled release version and executed exe file - now everything is ok. Thanks for good answer.
Vytas999
Great tip on Ctrl+F5
Greg R
+1  A: 

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.

John Myczek
It doesnt work for me, i still see the default icon. I set the new icon as you said.
Vytas999
When you run in Debug mode you will not see your application icon. You need to run in Release mode or "Start Without Debugging" (Ctrl+F5)
John Myczek
Great tip -- this worked for me for my issue with the "pinned" icon as well. Sweet!
Dave