Xaml - Bitmap UriSource - absolute path works, relative path does not, why?

故事扮演 提交于 2019-11-29 10:31:23

URIs can be confusing, as they can refer to both files on disk and resources in the application. So a relative path could be to a resource in the app, when you intend it to be on disk.

You can use the siteoforigin authority to force relative file URIs. This blog explains this more, but here an example:

pack://siteoforigin:,,,/path4.ico

Relative paths without qualifications look up the referenced file in the application resources, if a path should be relative to the executable you can use pack://siteoforigin:,,,/path4.ico, see Pack URIs on MSDN.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!