![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
| |
| | #1 (permalink) |
| | Application icon to Window Hi, I have set up an application icon in the project properties. Now, how can I use it in the application window? Thanks, Jan |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Application icon to Window In MSDN, there is written: ------------------------------- Windows Presentation Foundation (WPF) standalone applications have two types of icons: - One assembly icon, which is specified by using the <ApplicationIcon> property in the application's project build file. This icon is used as the desktop icon for an assembly. - One icon per window that is specified by setting Icon. For each window, this icon is used in its title bar, its task bar button, and in its ALT-TAB application selection list entry. 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: - Use the assembly icon, if specified. - If the assembly icon is not specified, use the default Microsoft Windows icon. -------------------------------- I checked project file, and there is <ApplicationIcon>Resources\Icon.ico</ApplicationIcon> However, the window still uses the default icon.... "Jan Kucera" <kucera@lupacovka.cz> wrote in message news:8D7AA8FF-1968-4191-BEEA-4096A2036F05@microsoft.com... > Hi, > I have set up an application icon in the project properties. Now, how can > I use it in the application window? > > Thanks, > Jan |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Application icon to Window Hi, Jan Kucera wrote: > Hi, > I have set up an application icon in the project properties. Now, how > can I use it in the application window? > > Thanks, > Jan You can use the following attribute in the Window tag: <Window x:Class="..." xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Icon="GalaSoft.ico"> HTH, Laurent -- Laurent Bugnion, GalaSoft Software engineering: http://www.galasoft-LB.ch PhotoAlbum: http://www.galasoft-LB.ch/pictures Support children in Calcutta: http://www.calcutta-espoir.ch |
My System Specs![]() |
| | #4 (permalink) |
| | Re: Application icon to Window Hi, thanks for reply. At first, this does not do the trick which is described in MSDN (using icon defined in project properties if none is set to window), but what is worse, this does not work to me. I have a file Resources\Icon.ico embedded as ApplicationIcon resource in Properties\Resources.resx and I cannot manage to display it. Simply <Window Icon="Resources\Icon.ico"> does not work, neither "Resources/Icon.ico" does, nor "ApplicationIcon", all of these throws exceptions. ("Cannot locate resource 'resources/icon.ico'.") By the way, if I type absolute path to the icon in this attribute, it throws "The image format is unrecognized." at runtime, but it normally compiles as project icon. (The icon has 16x16 XP, 32x32 XP and 256x256 XP format). Jan "Laurent Bugnion" <galasoft-lb@bluewin.ch> wrote in message news:%233YaVlPKHHA.4384@TK2MSFTNGP03.phx.gbl... > Hi, > > Jan Kucera wrote: >> Hi, >> I have set up an application icon in the project properties. Now, how can >> I use it in the application window? >> >> Thanks, >> Jan > > You can use the following attribute in the Window tag: > > <Window x:Class="..." > xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" > xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" > Icon="GalaSoft.ico"> > > HTH, > Laurent > -- > Laurent Bugnion, GalaSoft > Software engineering: http://www.galasoft-LB.ch > PhotoAlbum: http://www.galasoft-LB.ch/pictures > Support children in Calcutta: http://www.calcutta-espoir.ch |
My System Specs![]() |
| | #5 (permalink) |
| | Re: Application icon to Window Have you tried it without the "Resources/" prefix? I'm wondering if the subdirectory info is stripped out when the resource gets compiled & embedded into the app. If not, another thing to try is the pack format: "pack://application,,,/Resouces/Icon.ico" |
My System Specs![]() |
| | #6 (permalink) |
| | Re: Application icon to Window Hi, Icon.ico fails inside Cider and both during run-time. Pack format throws parser Exception whose InnerException is {"Exception has been thrown by the target of an invocation."} so I don't see what the problem is. Though, this would not do the application -> window trick... Thanks for try. "Keith Patrick" <richard_keith_patrick@nospam.hotmail.com> wrote in message news:O3fj0GmKHHA.420@TK2MSFTNGP06.phx.gbl... > Have you tried it without the "Resources/" prefix? I'm wondering if the > subdirectory info is stripped out when the resource gets compiled & > embedded into the app. If not, another thing to try is the pack format: > "pack://application,,,/Resouces/Icon.ico" > > > |
My System Specs![]() |
| | #7 (permalink) |
| | Re: Application icon to Window Jan, Using VS2005, I did the following: * I created a brand new wpf windows application project in WPF (with application definition and one window). * I added a new icon and customized it (with a smiley face .* I specified the icon as the application icon eg <ApplicationIcon>Icon1.ico</ApplicationIcon> When I debugged the app from VS2005, Window did not pick up the application icon. However, when I ran the built assembly directly from the desktop ie outside of VS2005, the icon was picked up. Are you seeing this behavior? "Jan Kucera" wrote: > Hi, > Icon.ico fails inside Cider and both during run-time. > Pack format throws parser Exception whose InnerException is {"Exception has > been thrown by the target of an invocation."} so I don't see what the > problem is. > > Though, this would not do the application -> window trick... > Thanks for try. > > "Keith Patrick" <richard_keith_patrick@nospam.hotmail.com> wrote in message > news:O3fj0GmKHHA.420@TK2MSFTNGP06.phx.gbl... > > Have you tried it without the "Resources/" prefix? I'm wondering if the > > subdirectory info is stripped out when the resource gets compiled & > > embedded into the app. If not, another thing to try is the pack format: > > "pack://application,,,/Resouces/Icon.ico" > > > > > > > |
My System Specs![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| application icon | General Discussion | |||
| set application window location? | Vista General | |||
| Application window moving up and down by itself | Vista General | |||
| Window Feedback Panel application | Vista General | |||