DZone
Mobile Zone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
  • Refcardz
  • Trend Reports
  • Webinars
  • Zones
  • |
    • Agile
    • AI
    • Big Data
    • Cloud
    • Database
    • DevOps
    • Integration
    • IoT
    • Java
    • Microservices
    • Open Source
    • Performance
    • Security
    • Web Dev
DZone > Mobile Zone > How to get the list of Songs, Genres, Albums from the Windows Phone MediaLibrary

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

Senthil Kumar user avatar by
Senthil Kumar
·
Nov. 03, 11 · Mobile Zone · Interview
Like (0)
Save
Tweet
3.98K Views

Join the DZone community and get the full member experience.

Join For Free
You can get the get the list of Songs, Genres, and Albums from the Windows Phone by using the MediaLibrary class defined in the Microsoft.Xna.Framework.Media Namespace.

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 Microsoft.Xna.Framework.Media;

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 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 Genre property to find Songs by Genre


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;

 


Source: http://windowsphonerocks.com/Developer/DeveloperArticles/tabid/64/Article/185/how-to-get-the-list-of-songsgenresalbums-from-the-windows-phone-medialibrary.aspx

Windows Phone

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • SQL vs. NoSQL: Pros and Cons
  • Internal Developer Platform in Plain English
  • Getting Started With RSocket Kotlin
  • API Security Weekly: Issue 165

Comments

Mobile Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • MVB Program
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends:

DZone.com is powered by 

AnswerHub logo