How To: Show Pictures

Demonstrates how to use the MediaLibrary to access pictures in a picture album.

The Complete Sample

The code in the topic shows you the technique. You can download a complete code sample for this topic, including full source code and any additional supporting files required by the sample.

Accessing Pictures

This example retrieves all pictures in a user's picture library.

Declare variables.

ICollection<MediaSource> mediaSources;
MediaLibrary mediaLib;
PictureCollection picCollection;

Access the media library.

mediaSources = MediaSource.GetAvailableMediaSources();
foreach (MediaSource ms in mediaSources)
    mediaLib = new MediaLibrary(ms);
picCollection = mediaLib.Pictures;

Community Additions