Absolute UriSource of a Resource image

Posted by Louis Rhys on Stack Overflow See other posts from Stack Overflow or by Louis Rhys
Published on 2010-12-24T03:47:35Z Indexed on 2010/12/24 3:54 UTC
Read the original article Hit count: 240

Filed under:
|
|
|

I have a WPF project. If I store image in {ProjectRoot}\Images\image.png, and compile it as Resource then I can access it from a xaml (this xaml is located at Root) as BitmapImage by BitmapImage UriSource="Images/image.png". But if I move the xaml to another folder, say {ProjectRoot}\Xamls, now I have to use BitmapImage UriSource="../Images/image.png". Is there a way to specify an absolute project path, so that I can refer to them with the same path regardless of the location of the xaml?

© Stack Overflow or respective owner

Related posts about .NET

Related posts about wpf