Check if a packed resource exists in WPF
Is there a way to check in code if a resource exists at an Uri su开发者_运维技巧ch as:
"pack://application:,,,/MyResource.jpg"
Just chop off the pack://application:,,,/ part of the string and do a File.Exists on the remaining part of the path.
Your snippet you posted is pointing to a file that lives in the root of the running application and is called MyResource.jpg.
精彩评论