How to apply the icon for my popup window in WPF? - c#

I have created two windows in my project root folder, MainWindow.xaml and PopupWindow.xaml respectively.
Through Project Properties, I managed to set up an icon for the MainWindow but I couldn't find any available settings for my PopupWindow. Therefore, the PopupWindow is still showing the system default icon in the top left corner.
Can anyone tell me where I can set up a customized icon for my PopupWindow?
Many thanks.
Edit:
I guess I made a mistake in the XMAL code previously. :[
Should have been more careful about the code. Anyways, here is the correct one
Icon="/[Your Project Name];component/[Your ICO File Name]"

Are you running in Debug mode in Visual Studio? WPF Windows don't inherit their icon from the application in debug mode. Try Ctrl+F5 ("Start Without Debugging") and see if your icons appear.

not sure but perhaps this helps
http://www.codeproject.com/KB/WPF/WPF_xaml_taskbar_window.aspx

Related

The application icon remains the same

I made a WPF application (.net core 3.1) and then towards the end I wanted to change the icon, as usual I opened the properties>application and loaded my icon. But it doesn't change anything... remains the same default icon.
The size of my icon is 256x256 and obviously has an .ico format. I tried to delete the folder where the executable is located and to build again, I also tried to run the application without debugging mode, but nothing. I noticed, however, that the main window when you change the Icon attribute updates the window icon. But nothing to do for the .exe file.
Does anyone know how to solve this problem?
P.S. I don't think it's the icon the problem because I tried to load another icon that I used in the past with another WPF application
Right click on your solution in Solution Explorer and click on "Rebuild Solution" or "Clean Solution" followed by "Build Solution".

Visual Studio will not show my .ico for project icon

I've tried and scouted around for a fix but I'm surprised by the lack of info out there. This process should be so simple and easy to implement, just changing the solution's icon to an acceptable-format icon.
However, I have tried to create my own icon and VS 2015 accepts that it is the correct size/format (I don't get error that states "Argument 'picture' must be a picture that can be used as an icon." but the icon in the top left corner of my winforms stays that awful default picture icon (not the 3 red/blue/yellow computer screen mind you, but the stupid broken page/form icon?), and on my task bar it stays the same, even though I've gone through project-->properties-->application--> and included my proper .ico with the correct location. I've also changed the Icon in the winforms property tab to be the same .ico file to no avail.
I've also tried to clean/rebuild solution, restart/reinstall VS 2015 comm and nothing.
Does anyone know what's going on with this? I've put this part of my project off as long as I could as it is just a cosmetic attribute really, but it's driving me nuts something so simple is too complicated or broken. I couldn't find specific information about the dimensions needed for .ico icon in my solution, but I know it's 32x32 pixels, and I've created all the variations of a 32x32 .ico in the visual studio paint editor. Visual Studio does not display a single one of them, just the broken blank page icon instead.
Just want stupid thing to display the right icon >.>
Thanks in advance.

C# VS2010 Setup Project makes no Icons and WinXP Error

I created a Setup Project and it works in Windows 7, but no icons are shown in the shortcuts. I added the icons in the Form, in the Setup Project, in the Desktop Icon tab, in the Start menu tab and in the Add/Remove tab. I added the same icon for all the configurations...could it be a problem with the size of the icon?
Another question:
I am getting an error when I try to install it in Win XP computers...I have no messages to post in here, because my WinXP computer opens the VS2010 for debugging and the debugger has nothing to show.
I've had the same problem recently. I've tried setting the shortcut icons to the app main output icon... didn't work. Then I've set added the same icon to the application folder and set to shortcut icons to that... didn't work either. The problem was the icon size. I've generated a multi size icon on https://icoconvert.com/ and behold. All the icons show properly now. Try doing that, maybe it wil fix the problem.

Why does the desktop icon differ from the explorer icon?

For some reason, a very old version of my icon keeps showing up when my application is dropped on the desktop. In the windows explorer (in all zooming levels) the icons is correctly the assembly icon. I specified the correct item in both XAML Window.Icon and in the project settings.
I have deleted the old version of my icon from all folders I can think of, but it still shows up. Also while drag and dropping, the wrong icon is shown. (in the slightly transparent preview window)
I tried cleaning and rebuilding, I tried deleting the obj folder manually...
The original, wrong icon was 16x16. I have built the new version as 32x32, because on the desktop 16x16 is too small.
According to the msdn docs (http://msdn.microsoft.com/en-us/library/system.windows.window.icon.aspx), each .ico file is supposed to incorporate all smaller sizes anyway.
I also checked that I changed the icon for both debug and release configuration.
Thanks for any ideas! :)
Could this be a problem with the IconCache? Try deleting %localappdata%\IconCache.db and restarting Explorer.exe.
Check the Visual Studio properties window for the EXE's project -- you can specify the icon that's written into the EXE at compile time. This is separate from the icon that's assigned to the XAML window at run time.

How to assign Application Icon that will display in Task bar?

I am working on a Wpf desktop application, whenever i run my application it shows me a window and associated tab in the task bar(Normal windows feature). My problem is that the tab is using window's icon for unknown file-type, I tried with Icon property of Window, Icon gets assigned but still problem is when I run application, task bar Tab initially displays window's icon for unknown file-type and when window-load completes it changes to the Icon assigned. I want Icon there from beginning. Any help?
Edit:
I tried with .csproj --> Properties --> Application Tab --> Icon
and set it to a .ico file. It works but I need to run my application by .exe file. It doesn't work in development environment(while running through visual studio). I need to set Start-Project option then. Is there any other way to solve this problem?
Check the properties of your main Window project.. You should be able to set an icon there.
Update:
Is it such a problem that your icon does not show in debug mode? As long as it works when you deliver the program to your customer, its all alright, not?
On a side note: You could check some things though. Perhaps your icon is not included in your project, or it isnt copied when building to your Debug folder?
Update 2:
You also need to set the Main Form's Icon for it to show in Debug. If you also set the icon for the main form, it will display in the Taskbar during Debug / Runtime.
I had a similar issue and google led me to this article. I forgot one simple thing, and that was my Main Form's Icon. If you also set the icon for the main form, it will display in the Taskbar during Debug / Runtime.
For WPF applications, use the attribute
Icon="Images\Logo.ico"
for the Window element in XAML to have the window show the icon.
I know this is old, but I found that I could get the icon to show in the taskbar in Debug mode if I went to the project's properties and checked the "Enable native code debugging" box on the "Debug" page
That worked for me. In a VB application, go to Debug screen of Project options (of the UI project) and select Enable unmanaged code debugging. Not sure if there are any negative side effects, but it sure showed the icon during debug. Thanks.
This is old but you can also change the shortcut icon in the setup projet, this is what worked for me (when viewing file system by right clicking the setup project).

Categories