Pay attention to the loading mode when developing WP. In WP7, resource files mainly have three buildaction attributes: Resource/content/none. By default, resource loading is selected.
When I first started learning WP development, I encountered a problem that most people would encounter: Why cannot images be displayed when the image is set to resource, you can set it to the content format.
(1) The three generation attributes of the resource file are briefly described as the differences between the three loading methods. Resource Method: when a program is packaged, the resource file is integrated into the xap file DLL. Content Method: resource files and DLL files are packaged into xap files independently. Sample, which exists in the compressed package as an actual image file. None method: The resource file is neither directly packaged in the xap file nor embedded in the xap DLL. during compilation, the resource file is completely ignored.
(2) set the URI of the image. Generally, when the resource file is integrated into the DLL, the start time of the program will include the time required to load the resource file, however, once these files are loaded, they can be quickly accessed during the program running. When a resource file exists in an independent form, the program will wait until the resource is loaded in real time. Therefore, when the program needs to be quickly started, you can set the resource file of the sample slice to the content generation attribute. Otherwise, you can set it to the resource attribute. The previously encountered image cannot be displayed because it is set to the resource attribute. One reason may be that the URI settings are incorrect. Resource and content have their own URI settings. For example, resource: <Image Source = ".. \ imagesasresource \ bg1.png"/>
Or <appnamespace; component/imagesascontent/bg1.png> content: <Image Source = "/imagesascontent/bg1.png"/>
Deepen understanding in this aspect. If you can flexibly load resource files, you can optimize the memory usage.