我怎样才能访问“后台”?图像通过代码

本文关键字:图像 代码 后台 访问 | 更新日期: 2023-09-27 18:12:22

我有全景项目附带的标准图像"background.png",我试图访问它。我尝试了这段代码,但没有检测到图像:

using (var store = IsolatedStorageFile.GetUserStoreForApplication())
{
    if (store.FileExists("Background.png"))
    {
        Debug.WriteLine("found");
    }
    else Debug.WriteLine("not found");
}

图像位于哪里?

真正的问题是,我通过"添加>现有项目>"添加一个文件到项目,并希望得到它的真实路径。

我怎样才能访问“后台”?图像通过代码

项目内的图像不存储在IsolatedStorage中。

var image = new Image
                              {
                                  Height = 29,
                                  Width = 30,
                                  Source =
                                      new BitmapImage(
                                      new Uri(@"background.png",
                                              UriKind.RelativeOrAbsolute))
};