Displaying User’s Image in Windows 8 Xaml App

In this post, we would see how we could display User’s Image.

Let’s create a sample app, and on Loaded event we would do all this code.

First of all we need to refer to the Windows.System.UserProfile namespace.

Now UserInformation has a static method as GetAccountPicture; which takes the AccountPictureKind as parameter.

As you see in below code, it has 3 different types: SmallImage, LargeImage, and Video

Let’s try to get both types of images.

As you see in above code; the method returns as IStorageFile, which needs to be converted to StorageFile.

And finally we would assign the image to the source of target image.

Here is the XAML for your reference.


Now, let’s run the application.

The small image max width and height is 100px each; and for large image the width and height is 512px each.

However, you could use it based on your requirement and size.

Full Source Code: Click Here

Hope you like this article, thanks for reading.