FileOpenPicker windows 10 Mobile

0

I want do an uwp app where I want use FileOpenPicker but the app work only on windows 10 and not on windows 10 mobile

On windows 10 mobile my app crash...and the exception message is: "Element not found. (Exception from HRESULT: 0x80070490)"

This is my code:

        FileOpenPicker openPicker = new FileOpenPicker();
        openPicker.ViewMode = PickerViewMode.Thumbnail;
        openPicker.SuggestedStartLocation = PickerLocationId.PicturesLibrary;
        openPicker.FileTypeFilter.Add(".jpg");
        openPicker.FileTypeFilter.Add(".jpeg");
        openPicker.FileTypeFilter.Add(".png");

        StorageFile file = await openPicker.PickSingleFileAsync();

        if (file != null)

        {

            var stream = await file.OpenAsync(Windows.Storage.FileAccessMode.Read);

            var image = new BitmapImage();

            ImageBrush ib = new ImageBrush();
            ib.ImageSource = image;

            image.SetSource(stream);

            var localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
            var filePath = file.Path;
            localSettings.Values["monimage"] = filePath;

            set.Background = new ImageBrush { ImageSource = image, Stretch = Stretch.UniformToFill };

        }

        else

        {

            //

        }

I have tested my app on windows 10 mobile 10.0.14393.693 I have not the possibility to test on others windows 10 mobile version but I think the problem is not the windows 10 version but my code...

c#
uwp
filepicker
asked on Stack Overflow Jan 15, 2017 by sami54 • edited Jan 15, 2017 by sami54

1 Answer

0

I solved myself the problem, I tested the others app of the store who use FileOpenPicker and they all have the same error so I reinstalled windows 10 mobile and all work well now :)

answered on Stack Overflow Jan 16, 2017 by sami54

User contributions licensed under CC BY-SA 3.0