How to get the list of Songs,Genres,Albums from the Windows Phone MediaLibrary ?

You can get the Get the List of Songs / Albums from the Windows Phone using the MediaLibrary class defined in the Microsoft.Xna.Framework.Media Namespace .

How to access MediaLibrary ?

To access the MediaLibrary Class , you should add the reference of the Microsoft.xna.Framework dll to your Windows Phone Application and add the following Namespace


Add the following code snippet

private void ListSongs()
   MediaLibrary lib = new MediaLibrary();
   var SongName = (from m in lib.Songs
   select m.Name).ToList();
   listBox1.ItemsSource = SongName;

The MediaLibrary Class includes the Songs property which is a SongsCollection . In the Above example the the LINQ Query is used to retreive the Names of the songs from the Songs Collection .

You should see the list of songs as shown below .

Did you notice the list of songs in Emulator ?

  • Another Melody Song
  • Melody Song
  • Rhythm Variation

These are the default songs that are included in the Emulator

The MediaLibrary class also includes the properties Genres to get the kind of Songs

MediaLibrary lib = new MediaLibrary();
var Genre = (from m in lib.Genres
select m.Name).ToList();
listBox1.ItemsSource = Genre;

You can also display the Albums using the property Albums defined in the MediaLibrary class

MediaLibrary lib = new MediaLibrary();
var Albums = (from m in lib.Albums
select m.Name).ToList();
listBox1.ItemsSource = Albums;


If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.


  1. Santosh July 21, 2014 Reply
  2. Santosh July 28, 2014 Reply

Leave a Reply to Santosh Cancel reply


Interesting BlogPosts to read

How to get an Enumerator from range of elements from ArrayList in C# ?
The code snippet shown in this blog post demonstrates how you can get the enumeraor from a range of ...
How to check for the column name in an SqlDataReader Object in C# ?
When working in ADO.NET for data access , there are times when you want to check to see if a column ...
Download - Pokemon Go for for Windows 10 (Third Party app)
Pokemon Go is one of the popular AR games for android and iOS devices and now , the game is made ava...