DZone
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
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
The Latest "Software Integration: The Intersection of APIs, Microservices, and Cloud-Based Systems" Trend Report
Get the report

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

Senthil Kumar user avatar by
Senthil Kumar
·
Nov. 03, 11 · Interview
Like (0)
Save
Tweet
Share
4.16K 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

  • Integrate AWS Secrets Manager in Spring Boot Application
  • 5 Steps for Getting Started in Deep Learning
  • Testing Level Dynamics: Achieving Confidence From Testing
  • 10 Most Popular Frameworks for Building RESTful APIs

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • 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: