WPF:在XAML中访问嵌入式资源

时间:2011-02-22 10:28:24

标签: c# xaml embedded-resource

  

可能重复:
  WPF image resources

我的 VS C#项目中有一些图像被声明为嵌入资源。我正在使用以下方法在.cs文件中访问它们:

Stream logoStream = GetType().Assembly.GetManifestResourceStream("ProjNS.Image.logo.png");
Bitmap logo = new Bitmap(logoStream);

但是如何在.xaml文件中访问我的徽标?

1 个答案:

答案 0 :(得分:0)

像这样调用资源;

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