Filtering the FileOpenPicker

February 15, 2013

tips word in wood type

I’m currently working on a Windows Store app that plays videos. I know you’re probably thinking, “Um, dude, there’s already an app for that called Video.” Yes, I know there is, but my app is for a very specific use case. I don’t want to share what that is until it’s in the store, so please be patient. However, I do want to share little tips and tricks I learn along the way that might help you in developing your Windows Store apps.

Similar to the Video app, I want users to be able to select which video they want to play within the app. Obviously this means I need to use the FileOpenPicker, but I want to do three things as part of the user experience with the FileOpenPicker:

  1. I want the FileOpenPicker to display thumbnails of files
  2. I want the FileOpenPicker to start in the user’s video library
  3. I want the FileOpenPicker to allow users to select only .mp4 and .wmv files.

A little trial and error along with some Bing-Fu led me to implementing this simple solution:

It works like a champ and meets my requirements. I hope it helps you.