When developing frontend applications, especially on a platform like Silverlight and Windows Phone you will always need to load resources, whether from remote or local locations, you need to deal with URIs.
On Windows Phone there are a few rules regarding the usage of URIs to load resources, which might be difficult to remember. In particular, remembering when to use the leading forward slash.
So, here's a list of the most important ones for your reference.
- Navigation URIs must have a leading slash.
- URIs pointing to a resource file (file's build action set to Resource) must not have a leading slash.
- URIs pointing to a content file (file's build action set to Content) work both ways, slash or no slash.
Remember that when you set the build action of an asset file on the project to Resource, it will be embedded in the DLL created inside the .xap file, and it will effectively increase the size of the DLL, which might make the app slower to load. For most assets, you will want to set the build action to "Content" which will include the assets in the .xap file and they will be accessed directly by the app, but without having them embedded in the DLL, which in most cases is the desirable scenario.
Hope it helps and saves you some time!