Bagikan melalui


AdControl Class

Definition

Represents a control that displays banner ads in an app.

public ref class AdControl sealed : StackPanel, IClosable
/// [Windows.Foundation.Metadata.Activatable(1)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.Foundation.Metadata.Version(1)]
/// [Windows.Foundation.Metadata.WebHostHidden]
class AdControl final : StackPanel, IClosable
[Windows.Foundation.Metadata.Activatable(1)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.Foundation.Metadata.Version(1)]
[Windows.Foundation.Metadata.WebHostHidden]
public sealed class AdControl : StackPanel, System.IDisposable
Public NotInheritable Class AdControl
Inherits StackPanel
Implements IDisposable
Inheritance
AdControl
Attributes
Implements

Additional features and requirements

Software Development Kit
Minimum supported OS
Windows 10 (10.0.10240.0)

Remarks

For walkthroughs and code examples that demonstrate how to use this type, see AdControl in XAML and .NET, AdControl in HTML 5 and JavaScript and Advertising samples on GitHub.

Constructors

AdControl()

Initializes a new instance of the AdControl class.

Properties

AdUnitId

Gets or sets the ad unit identifier for this AdControl object. This value is available in Partner Center.

ApplicationId

Gets or sets the application ID for this AdControl object. This value is available in Partner Center.

AutoRefreshIntervalInSeconds

Gets or sets the interval at which the AdControl refreshes the currently displayed banner ad, in seconds.

CountryOrRegion

Gets or sets the two-letter country or region code where the user is located.

HasAd

Gets a value that indicates whether or not the AdControl is currently serving a banner ad.

IsAutoRefreshEnabled

Gets or sets a value that indicates whether automatic rotation of banner ads is enabled.

IsEngaged

Gets a value that indicates whether the user is interacting with the banner ad.

IsSuspended

Gets a value that indicates whether the AdControl is in a suspended state.

Keywords

Gets or sets the keywords that target the audience for advertisements.

PostalCode

Gets or sets the postal code to target for the banner ad.

Methods

AddAdTag(String, String)

Adds an ad tag to the AdControl.

Close()

Frees associated system resources used by the control.

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Refresh()

Directs the AdControl to show the next ad when a new one becomes available, if auto-refresh is disabled. The currently rendered ad remains until the next ad becomes available.

RemoveAdTag(String)

Removes an ad tag from the AdControl.

Resume()

Resumes the normal display of a banner ad after a call to Suspend.

Suspend()

Suspends the current banner ad and replaces the current view of the banner ad with a static snapshot of what was being rendered.

Events

AdRefreshed

Raised when the AdControl receives a new banner ad.

ErrorOccurred

Raised when the AdControl encounters an operational error.

IsEngagedChanged

Raised when the user clicks the banner ad and is interacting with it rather than the app.

OnManipulationStateChanged

Raised when the AdControl receives a manipulation state changed event from the banner ad.

OnMouseWheel

Raised when the AdControl receives a mouse wheel event.

OnPointerDown

Raised when the user clicks, points, or touches the banner ad.

OnPointerMove

Raised when the pointing device is moved.

OnPointerUp

Raised when the user has stopped clicking, pointing, or touching a banner ad.

Applies to

See also