Answered by:
Can't open FileOpenPicker with only MP3 files in Windows Phone 8.1

Question
-
Below is my implementation. Clicking on button does nothing. How can I use FileOpenPicker to display only MP3 files? Though it shows me videos (MP4) as well as images (JPEG, PNG) if I set file type filter as only "PNG". Is there no effect of FileTypeFilter?
private void btnPick_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e) { FileOpenPicker openPicker = new FileOpenPicker(); openPicker.FileTypeFilter.Add(".mp3"); App.ContinuationEventArgsChanged += App_ContinuationEventArgsChanged; openPicker.PickMultipleFilesAndContinue(); } private void App_ContinuationEventArgsChanged(object sender, IContinuationActivatedEventArgs e) { App.ContinuationEventArgsChanged -= App_ContinuationEventArgsChanged; var openFileArgs = e as FileOpenPickerContinuationEventArgs; foreach (var file in openFileArgs.Files) { //tb is TextBlock tb.Text = file.Name + "\n"; } }
Wednesday, August 6, 2014 1:27 PM
Answers
-
FileOpenPicker with MP3 file type filter works only in device, emulator doesn't open it without any error/exception.
- Marked as answer by Xyroid Thursday, August 28, 2014 8:59 AM
Thursday, August 28, 2014 8:59 AM
All replies
-
To be clear, When you say 'nothing' you don't hit that breakpoint in code and you do not see a picker?
Jeff Sanders (MSFT)
@jsandersrocks - Windows Store Developer Solutions @WSDevSol
Getting Started With Windows Azure Mobile Services development? Click here
Getting Started With Windows Phone or Store app development? Click here
My Team Blog: Windows Store & Phone Developer Solutions
My Blog: Http Client Protocol Issues (and other fun stuff I support)Thursday, August 7, 2014 1:21 PM -
Also, I suggest you start with our sample: http://code.msdn.microsoft.com/windowsapps/File-picker-sample-9f294cba
change the filter to .mp3 and you will see how this works from that reference implementation
Jeff Sanders (MSFT)
@jsandersrocks - Windows Store Developer Solutions @WSDevSol
Getting Started With Windows Azure Mobile Services development? Click here
Getting Started With Windows Phone or Store app development? Click here
My Team Blog: Windows Store & Phone Developer Solutions
My Blog: Http Client Protocol Issues (and other fun stuff I support)- Proposed as answer by Jeff SandersMicrosoft employee Thursday, August 7, 2014 1:31 PM
Thursday, August 7, 2014 1:31 PM -
The code hits the breakpoint. My code works flawlessly in device, but emulator doesn't open the file picker. I tried MSDN sample also. "Nothing" means the code executes but no action is being execute.Thursday, August 7, 2014 1:57 PM
-
It must be a problem with your emulator. You can remove the emulator from the Hyper-V manager. When you start the emulator again it will load a new one.
If that does not work, try re-installing the 8.1 emulators.
Jeff Sanders (MSFT)
@jsandersrocks - Windows Store Developer Solutions @WSDevSol
Getting Started With Windows Azure Mobile Services development? Click here
Getting Started With Windows Phone or Store app development? Click here
My Team Blog: Windows Store & Phone Developer Solutions
My Blog: Http Client Protocol Issues (and other fun stuff I support)Thursday, August 7, 2014 1:59 PM -
OK, I will check it & let you know.Thursday, August 7, 2014 2:01 PM
-
FileOpenPicker with MP3 file type filter works only in device, emulator doesn't open it without any error/exception.
- Marked as answer by Xyroid Thursday, August 28, 2014 8:59 AM
Thursday, August 28, 2014 8:59 AM