将图像嵌入到wpf路由中,并在xaml中使用 [英] Embed an image in the wpf rerouces and use it in the xaml
本文介绍了将图像嵌入到wpf路由中,并在xaml中使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
不好意思,我是wpf的新手.
我想将图像用作xaml窗口的图标".我希望将此图像嵌入到exe中.
最好的方法是什么?
请包括所有必需的步骤.
---------------
到目前为止,我已经尝试过:
Excuse the novice question, I''m new to wpf.
I want to use an image as the "Icon" of a xaml window. I want this image to be embedded in the exe.
what''s the best way?
Please include ALL required steps.
---------------
so far, I''ve tried this:
<Window ...
Icon="{StaticResource MyIco}">
...
<BitmapImage x:Key="MyIco" UriSource="TheIco" />
TheIco
是我添加的资源,可以在Resources.resx文件中看到
---------------
我做错了什么或做这件事的最好方法是什么?
谢谢,
Herb
TheIco
is a resource I''ve added and which I can see in the Resources.resx file
---------------
What am I doing wrong or what''s the best way to do this?
Thanks,
Herb
推荐答案
将图像作为文件而不是Resources.resx添加到项目中.并查看此文章
Add image to the project as a file, not to Resources.resx. And look at this article
这篇关于将图像嵌入到wpf路由中,并在xaml中使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文