1 out of 1 rated this helpful - Rate this topic

Using the Visual Studio 2010 Visual Designer

The following steps are a guide to using the Visual Studio 2010 Visual Designer to integrate advertising into Windows Phone applications.

Prerequisites

Integrate an AdControl into an Application by Using the Visual Studio 2010 Visual Designer

  1. Open Visual Studio and create a new project.

  2. From the installed templates section (on the left), expand Visual C# and click Silverlight for Windows Phone.

  3. Select the type of application you are building—for example, Windows Phone Application.

    Select the type of Application you are building
  4. Name the project (for example, AdControlTest), and click OK.

  5. In the Toolbox, you should see the AdControl in the Windows Phone Controls tab.

    You should now see AdControl in your new tab
  6. Drag and drop the AdControl into the Application Designer. Position the AdControl so that it is fully visible in the Application Designer.

  7. In the Application Designer, right-click the AdControl. On the context menu, click Properties.

    From the context menu choose “Properties”
  8. You should now see the AdControl properties in the Visual Studio Properties panel.

  9. Set the control size either by dragging and dropping the border in the designer or by specifying the size in the Properties pane.For example, Width = 480, Height = 80.

    Set values in the Visual Studio Properties window.
  10. You can use test IDs to see how the ads will look in your application. In the Properties panel, configure the following properties:

    1. Set AdUnitId to Image480_80. For more information about test values, see Test Values for AdUnitId and ApplicationId.

    2. Set ApplicationId to test_client. For more information about test values, see Test Values for AdUnitId and ApplicationId.

  11. Run your application and you will see a sample test ad.

    Run your code and the AdControl shows

In order to receive live ads, you will need to register with Microsoft pubCenter. For more information, see Getting Access to Microsoft pubCenter and Receiving Ads.
After registration, you will receive an official ApplicationId and AdUnitId to use in the AdControl.

See Also


Send feedback about this documentation to adsfdbk@microsoft.com.
Publication date: 2012-03-09
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
What to do..
In which way exactly the new advertising SDK version handles that issue?
Have we to add code to handle this kind of issue or not anymore?
Exceptions When Navigating Away from a Page
The November update of the Advertising SDK implements better exception handling for the circumstance JShort describes. Download and install from http://www.microsoft.com/download/en/details.aspx?id=8729.
Important Note about Exceptions
It should be important to note that doing this method can result in exceptions in your application from the adcontrol.  If the ad is busy loading when the user leaves this page you will get an exception.  The only work around I have found is to not use the UI, but to add the adcontrol through the code behind.  Then when the form is unloading remove the adcontrol.