Export (0) Print
Expand All

AdControl Class - March 2011 (Deprecated)

Provides the information needed to display advertising in your application.


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

public class AdControl :  UserControl

When the AdControl is instantiated by using the default constructor, the rotationEnabled parameter is set to true. The AdControl will then show a new ad every 60 seconds.

If this behavior does not suit the application, you can instantiate the AdControl with automatic ad rotation deactivated. To do this, call the overloaded constructor with the rotationEnabled parameter set to false. This will allow the application to call the RequestNextAd method to show the next ad.

Use one or more unique instances of an AdControl on a page. Do not use the same instance of an AdControl across multiple pages.

Once set, the parent of an AdControl should not be changed.

All required properties of the AdControl need to be set when the AdControl is instantiated. The required properties are AdUnitId, ApplicationId, and AdModel.

The following code instantiates a new AdControl and sets mandatory targeting parameters.

AdControl ctrl = new AdControl();
ctrl.ApplicationId = "testapplication";
ctrl.AdUnitId = "testadunit";

The following code instantiates a new AdControl with manual ad rotation.

string applicationId = "testapplication";
string adUnitId = "testadunit";
bool isAutoRotation = false;
AdControl ctrl = new AdControl(applicationId, adUnitId, AdModel.Contextual, isAutoRotation);

ctrl.Width = 480;
ctrl.Height = 80;

The following XAML instantiates a new AdControl with mandatory targeting parameters.

<Grid xmlns:adctl="clr-namespace:Microsoft.Advertising.Mobile.UI;assembly=Microsoft.Advertising.Mobile.UI" Grid.Row="1">
   <adctl:AdControl Height="80" Width="480" AdUnitId="Test" ApplicationId="Test" AdModel="Contextual" />

Object :: DependencyObject :: UIElement :: FrameworkElement :: Control :: UserControl :: Microsoft.Advertising.Mobile.UI.AdControl

Community Additions

© 2014 Microsoft