Uri for bitmap in subfolder (c# wpf)

Posted by the empirical programmer on Stack Overflow See other posts from Stack Overflow or by the empirical programmer
Published on 2010-06-10T21:35:16Z Indexed on 2010/06/10 21:52 UTC
Read the original article Hit count: 285

Filed under:
|
|

I have a wpf app where I'm using an image. To reference the image I use:

Uri uri = new Uri("pack://application:,,,/assemblyName;Component/myIcon.png");
BitmapImage(uri)

If I add the png directly under the csproj file (with its properties BuildAction=Resource) then it works fine.

But I want to move it to a subfolder under the csproj. Another SO question asked about bitmaps\uri's (857732) and an answer linked to this msdn. So I tried :

Uri uri = new Uri("pack://application:,,,/assemblyName;Component/Icons/myIcon.png");

But that did not work.

Any ideas?

© Stack Overflow or respective owner

Related posts about c#

Related posts about bitmap