Resource from assembly as a stream
Solution 1:
You're probably looking for Application.GetResourceStream
StreamResourceInfo sri = Application.GetResourceStream(new Uri("Images/foo.png"));
if (sri != null)
{
using (Stream s = sri.Stream)
{
// Do something with the stream...
}
}
Solution 2:
GetManifestResourceStream is for traditional .NET resources i.e. those referenced in RESX files. These are not the same as WPF resources i.e. those added with a build action of Resource. To access these you should use Application.GetResourceStream, passing in the appropriate pack: URI. This returns a StreamResourceInfo object, which has a Stream property to access the resource's data.
Solution 3:
If I get you right, you have a problem to open the resource stream, because you do not know its exact name? If so, you could use
System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceNames()
to get a list of names of all included resources. This way you can find the resource name that was assignd to your image.