This topic has not yet been rated - Rate this topic

How to use the Marketplace search task for Windows Phone

May 03, 2013

Applies to: Windows Phone 8 | Windows Phone OS 7.1

Use the Marketplace search task to launch the Store or Marketplace and then display the search results from the specified search terms. You can specify the type of content to search for, such as music or apps.

By using Launchers, you help provide a consistent user experience throughout the Windows Phone platform. For more information, see Launchers and Choosers for Windows Phone.

To search the Store for an app

  1. Add the following statement to your code.

    using Microsoft.Phone.Tasks;
    
  2. Add the following code to your app, and specify the search terms. Add the code to your app wherever you need it, such as in a button click event. To test this procedure, you can put the code in the page constructor. This is the code to launch the task.

    //Search for an application, which is the default content type.
    MarketplaceSearchTask marketplaceSearchTask = new MarketplaceSearchTask();
    
    marketplaceSearchTask.SearchTerms = "accelerometer xna";
    
    marketplaceSearchTask.Show();
    

To search the Store for music

  1. Add the following statement to your code.

    using Microsoft.Phone.Tasks;
    
  2. Add the following code to your app, and specify the search terms. Add the code to your app wherever you need it, such as in a button click event. To test this procedure, you can put the code in the page constructor. This is the code to launch the task.

    //Search for a music item.
    MarketplaceSearchTask marketplaceSearchTask = new MarketplaceSearchTask();
    
    marketplaceSearchTask.ContentType = MarketplaceContentType.Music;
    marketplaceSearchTask.SearchTerms = "song title";
    
    marketplaceSearchTask.Show();
    

Did you find this helpful?
(1500 characters remaining)
© 2013 Microsoft. All rights reserved.