WPF: Accessing an embedded resource in XAML [duplicate]

心已入冬 提交于 2019-12-08 17:12:29

问题


Possible Duplicate:
WPF image resources

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);

But how can I access my logo in the .xaml file?


回答1:


Call the Resource like this;

<Image Source="Resources/ProjNS.Image.logo.png" height="100" width="100"/>


来源:https://stackoverflow.com/questions/5076927/wpf-accessing-an-embedded-resource-in-xaml

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!