Wpf – relative image source path

There’s a handy method in System.IO.Path which can help with this:

return Path.GetFullPath("Resources/image.jpg");

This should return ‘C:\Folders\MoreFolders\Resources\image.jpg’ or whatever the full path is in your context. It will use the current working folder as the starting point.

Link to MSDN documentation on GetFullPath.

Leave a Comment