Click here to Skip to main content
12,892,320 members (48,087 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


3 bookmarked
Posted 5 Aug 2014

Browse Photo in Windows Phone 8.1

, 5 Aug 2014 CPOL
Rate this:
Please Sign up or sign in to vote.
This tip will show the new way to browse photos with Windows Phone 8.1


While developing apps, we need to browse Picture to modify them or to add user's information. Here is the easy way to do it on Windows Phone 8.1.


It is so easy to Browse Photo in Windows Phone 8.0, however Windows Phone 8.1 has included some big changes.

Using the Code

First of all, you must add the capability PictureLibrary in the manifest file.

Add the Action Click on Button to Browse Picture:

private void PickImage_Click(object sender, RoutedEventArgs e)
           var openPicker = new FileOpenPicker
                 SuggestedStartLocation = PickerLocationId.PicturesLibrary,
                 ViewMode = PickerViewMode.Thumbnail

           // Filter to include a sample subset of file types.

       catch (Exception)


We add the majority of extensions that we use (bmp, png, jpeg, jpg).

Then this code calls the function PickImage that transfers the Picker to file.

Add the following code:

private async void PickImage(FileOpenPicker openPicker)
             this.completionSource = new TaskCompletionSource<StorageFile>();


             StorageFile file = await this.completionSource.Task;

             if (file != null)
                img.Source = await MakeImage(file);

After that, we set the Source of the Image, but after the Call of the Function MakeImage that transfers File to BitmapImage.

Add the function MakeImage:

TaskCompletionSource<StorageFile> completionSource;

WriteableBitmap writimage;

async Task<ImageSource> MakeImage(StorageFile file)
     BitmapImage bitmapImage = null;

     if (file != null)
         bitmapImage = new BitmapImage();

         using (var stream = await file.OpenReadAsync())
             await bitmapImage.SetSourceAsync(stream);
     return (bitmapImage);


Browsing pictures is one of the famous keys to developing and building a useful app.


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


About the Author

Anis Derbel
Software Developer (Junior) Microsoft Student Partners
Tunisia Tunisia
I study Software Engineering , 23 years old , I'm motivated with all Technologies of Microsoft.
Since I have been in the Community of Microsoft as Microsoft Student Partners, I developped many apps on the platform Windows and Phone. Now , it's time to share what I learn here and I'am ready to help Everyone.
You can contact me at any time (
Group type: Organisation

9 members

You may also be interested in...

Comments and Discussions

-- There are no messages in this forum --
Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170424.1 | Last Updated 5 Aug 2014
Article Copyright 2014 by Anis Derbel
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid