如何在 WPF 中为我的弹出窗口应用图标?
我在项目根文件夹中创建了两个窗口,分别是 MainWindow.xaml
和 PopupWindow.xaml
。
通过项目属性
,我设法为 MainWindow 设置了一个图标,但我找不到 PopupWindow 的任何可用设置。因此,PopupWindow左上角仍然显示系统默认图标。
谁能告诉我在哪里可以为 PopupWindow 设置自定义图标?
非常感谢。
编辑:
我想我之前在 XMAL 代码中犯了一个错误。 :[ 应该对代码更加小心。无论如何,这是正确的
Icon="/[您的项目名称];component/[您的 ICO 文件名]"
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]"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是否在 Visual Studio 中以调试模式运行? WPF Windows 不会从调试模式下的应用程序继承其图标。尝试按 Ctrl+F5(“启动而不调试”)并查看图标是否出现。
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.
不确定,但这也许有帮助
http://www.codeproject.com/KB/WPF/WPF_xaml_taskbar_window.aspx
not sure but perhaps this helps
http://www.codeproject.com/KB/WPF/WPF_xaml_taskbar_window.aspx