Click here to Skip to main content
Click here to Skip to main content
Technical Blog

Tagged as

How to search in the WP7 Marketplace using the MarketplaceSearchTask?

, 19 Apr 2012 CPOL
Rate this:
Please Sign up or sign in to vote.
In your Windows Phone 7 application, you may want to search for some application or music rom WP7 Marketplace. How will you do this? This small tips on Windows Phone 7 marketplace related API will help you to write code in your application.   You can easily achieve this by using the Marketplace La

In your Windows Phone 7 application, you may want to search for some application or music rom WP7 Marketplace. How will you do this? This small tips on Windows Phone 7 marketplace related API will help you to write code in your application.

You can easily achieve this by using the Marketplace Launchers task to call the search API. Continue reading to know more about it.

Know about the API

"MarketplaceSearchTask" is a launchers task which allows user to search the marketplace by launching the Windows Phone marketplace client application and display the search results in the screen. You can customize the API to search either for Application or Music contents by providing the MarketplaceContentType property as shown below:

public enum MarketplaceContentType { Applications = 1, Music = 2 }

If you specify the ContentType of MarketplaceSearchTask as Application, it will search for applications and if you specify Music, it will search for only music based on your searched terms.

Code and Demo

Now it’s time for us to see the code and demo. Let us first demonstrate the use of the Application content type to search for applications. The following code implements the same:

var marketplaceSearchTask = new MarketplaceSearchTask

                                    ContentType = MarketplaceContentType.Applications,
                                    SearchTerms = "Easy Connect" // Enter the search term here
                                };
 
marketplaceSearchTask.Show();

The above code will launch the Windows Phone 7 Marketplace Search and list out the results based on the searched terms as shown below:

Here is the small demonstration about the Music search. The below code will search for music with the specified searched terms:

var marketplaceSearchTask = new MarketplaceSearchTask

                                    ContentType = MarketplaceContentType.Music,
                                    SearchTerms = "Blue" // Enter the search term here
                                };

marketplaceSearchTask.Show();

Once you call the Show() method, it will launch the marketplace search and list out the full results in the screen as demonstrated below:

Hope, this small post was helpful for you to understand the use of the API "MarketplaceSearchTask". Stay tuned to my blog, facebook and twitter for many more articles, news and tips on Silverlight and Windows Phone 7.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Kunal Chowdhury (@kunal2383)
Team Leader
India India
Kunal Chowdhury is a Microsoft "Windows Platform Development" MVP (Most Valuable Professional), a Codeproject Mentor, Telerik MVP, Nokia Developer Champion, Speaker in various Microsoft events, Author, passionate Blogger and a Software Engineer by profession.
 
He is currently working in an MNC located in India. He has a very good skill over XAML, C#, Silverlight, Windows Phone, WPF and Windows Store (WinRT) app development. He posts his findings, articles, tutorials in his technical blog and CodeProject.
 
Technical Blog: http://www.kunal-chowdhury.com
Facebook: http://facebook.com/blog.kunal
Twitter : http://twitter.com/kunal2383
Follow on   Twitter   Google+   LinkedIn

Comments and Discussions

 
-- There are no messages in this forum --
| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.150129.1 | Last Updated 19 Apr 2012
Article Copyright 2012 by Kunal Chowdhury (@kunal2383)
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid