Image retrieve from picture folder blank RRS feed

  • Question

  • I have problem on retrieve image in the picture folder. I have the image path to it. But it displays randomly. Here is the screenshot

    Thanks, Smiths

    • Edited by Reid Smiths Friday, November 15, 2013 2:05 AM editing
    Friday, November 15, 2013 2:04 AM

All replies

  • What code are you using for this? What errors (if any) are you getting? At what point does this fail? When you say "randomly" do you mean that the same image sometimes works and sometimes doesn't?

    Can you reproduce this in a minimal project that you can share?

    Friday, November 15, 2013 6:50 PM
  • Sorry but it hard to reproduce in minimal. But can share the code.

    1) The code I am using is here below:

    private ImageSource _image = null;
            private String _imagePath = null;
            public ImageSource Image
                    if (this._image == null && this._imagePath != null)
                    return this._image;
                    this._imagePath = null;
                    this.SetProperty(ref this._image, value);
            private async void LoadImages()
                Windows.Storage.StorageFile imageFile = await Windows.Storage.KnownFolders.PicturesLibrary.GetFileAsync(_imagePath);
                BitmapImage img = new BitmapImage();
                FileRandomAccessStream stream = (FileRandomAccessStream)await imageFile.OpenAsync(FileAccessMode.Read);
                this._image = img;
            public void SetImage(String path)
                this._image = null;
                this._imagePath = path;

    2) I got no error. It runs but I have three page that display image but only this page does not works.

    3) It displays randomly, which means the grid sometime show the image and other time it display other side with no fixed place.

    Thanks, Smiths

    Saturday, November 16, 2013 6:22 AM