WPF: Accessing an embedded resource in XAML [dupli

2019-06-17 03:43发布

问题:

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"/>