Application.GetResourceStream called on a Content Resource still return null

后端 未结 1 1038
眼角桃花
眼角桃花 2020-12-06 11:43

Here is the task-related part of the VS2010 project (Windows Phone) structure:

\"enter

相关标签:
1条回答
  • 2020-12-06 12:08

    The path supplied Application.GetResourceStream isn't relative to the position of the class, but relative to the application package.

    StreamResourceInfo albumArtPlaceholder = 
        Application.GetResourceStream(
            new Uri("Images/artwork.placeholder.png", UriKind.Relative));
    

    Would be the correct path. You can also try with a full pack URI. (see MSDN)

    And finally, Resource would be the correct Build Action for this.

    0 讨论(0)
提交回复
热议问题