C# 如何更改 WPF 应用程序的图标

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13281143/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-10 08:03:50  来源:igfitidea点击:

How can I change the Icon of WPF application

c#wpf

提问by Kev Fixes

Possible Duplicate:
WPF Icon for all app windows

可能重复:
所有应用程序窗口的 WPF 图标

I have a wpfapplication, I want to set the icon for all the windows.

我有一个wpf应用程序,我想为所有窗口设置图标。

I have and icofile in my project folder /img/app.ico, but it is build action = Resource.

ico在我的项目文件夹 /img/app.ico 中有一个文件,但它是build action = Resource.

I change the application Icon and manifestto /img/app.ico, but it won't work.

我将应用程序更改Icon and manifest/img/app.ico,但它不起作用。

An error is prompt when compiling:

编译时提示错误:

The img/app.ico is not found.

回答by COLD TOLD

Have you tried to force icon

你有没有试过强制图标

<Window Icon="youricon.ico"></Window>

http://msdn.microsoft.com/en-us/library/system.windows.window.icon.aspx

http://msdn.microsoft.com/en-us/library/system.windows.window.icon.aspx