Export (0) Print
Expand All

AdControl - Constructors

Updated: March 31, 2014

Published: April 2, 2014

Instantiates a new AdControl.

Namespace: Microsoft.Advertising.Mobile.UI

Assembly: Microsoft.Advertising.Mobile.UI (in Microsoft.Advertising.Mobile.UI.dll)

The AdControl has a default constructor and one overload.

The Modern Windows UI expects the UI to be constructed and coded using markup (XAML/Silverlight). Using the API in code behind files to construct the UI does not follow the Modern UI programming model.

public AdControl()
public AdControl(string ApplicationId, string AdUnitId, bool isAutoRefreshEnabled)

Example

This is an example of how to use the AdControl constructor. It is included here for reference.

The Modern Windows UI expects the UI to be constructed using markup (XAML/Silverlight). Using the API in code behind files to construct the UI does not follow the Modern UI programming model.

This example is for a Silverlight framework app.

// ApplicationID = "test_client", AdUnitID = "Image480_80", 

       AdControl adControl = new AdControl("test_client",   // ApplicationID
                                           "Image480_80",   // AdUnitID
                                           true);           // isAutoRefreshEnabled

      // Make the AdControl size large enough that it can contain the image
      adControl.Width = 480;
      adControl.Height = 80;

Example

This example is for a XAML framework app.

// ApplicationID = "test_client", AdUnitID = "Image320_50", 

       AdControl adControl = new AdControl("test_client",   // ApplicationID
                                           "Image320_50",   // AdUnitID
                                           true);           // isAutoRefreshEnabled

      // Make the AdControl size large enough that it can contain the image
      adControl.Width = 320;
      adControl.Height = 50;

Default Values

Item

Default Value

size

XAML: 320 pixels x 50 pixels

Silverlight: 480 pixels x 80 pixels

IsAutoRefreshEnabled

true

You must manually set the ApplicationId and AdUnitId properties before an ad can be displayed.

The size property is inherited from the FrameworkElement class.

AdControl Size

The size property is inherited from the FrameworkElement class.

XAML

The default AdControl size is 320x50 pixels.

Silverlight

The default AdControl size is 480x80 pixels.

Platforms

Windows Phone 7.x, Windows Phone 8.x

Support and Feedback

Get product support or report a bug in the product by visiting the Windows Phone Dev Center support page (scroll down to the section "Microsoft Advertising support").

Send feedback about this documentation to adsfdbk@microsoft.com. There is no product support through this alias. Documentation feedback only.

Community Additions

ADD
Show:
© 2014 Microsoft