Click here to Skip to main content
15,890,438 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi!,

I can do it for wpf and windows 10 desktop apps but apparently for windows phone it's totally a different way.

Is there an easy way to pick a file with the file open picker on windows phone?

This code is for windows 10 store apps but I need a way to do it for windows phone.
It seems MS has over complicated the way it's done for windows phone.

C#
private async void btnOpenFilePicker_Click(object sender, RoutedEventArgs e)
        {
            var picker = new Windows.Storage.Pickers.FileOpenPicker();            
            picker.ViewMode = Windows.Storage.Pickers.PickerViewMode.Thumbnail;
            picker.SuggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.PicturesLibrary;
            picker.FileTypeFilter.Add(".txt");


            Classes.ClassDynamicFlashCards.file = await picker.PickSingleFileAsync();
            if (Classes.ClassDynamicFlashCards.file != null)
            {                              
                this.Frame.Navigate(typeof(FlashCardTemplate1));                
            }
            else
            {
                MessageDialog dialog = new MessageDialog("Operation cancelled");
                await dialog.ShowAsync();          
            }
        }
Posted
Comments
Kornfeld Eliyahu Peter 18-Oct-15 4:59am    
Check this: https://code.msdn.microsoft.com/windowsapps/File-picker-sample-9f294cba
MedinaVS 18-Oct-15 5:32am    
Thanks!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900