WPF:访问XAML中的嵌入式资源 [英] WPF: Accessing an embedded resource in XAML
本文介绍了WPF:访问XAML中的嵌入式资源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
可能重复:
WPF图像资源
我的 VS C#中有一些图像项目,它们被声明为嵌入式资源。我正在使用以下.cs文件访问它们:
I have some images in my VS C# project that are declared as embedded resources. I'm accessing them in the .cs file using:
Stream logoStream = GetType().Assembly.GetManifestResourceStream("ProjNS.Image.logo.png");
Bitmap logo = new Bitmap(logoStream);
但是我如何访问.xaml文件中的徽标?
But how can I access my logo in the .xaml file?
推荐答案
像这样调用资源;
<Image Source="Resources/ProjNS.Image.logo.png" height="100" width="100"/>
这篇关于WPF:访问XAML中的嵌入式资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文