AdControl Config Sample screenshot 1 AdControl Config Sample screenshot 2 AdControl Config Sample screenshot 3 AdControl Config Sample screenshot 4 AdControl Config Sample screenshot 5
Supported Devices
PC
Updated
May 19,2019
Size
300.94 KB
Age
Everyone
Release Date
Description
The Microsoft Advertising SDK for Windows 8 allows developers to show ads in their apps. When you look at the walkthrough for putting ads in an app using XAML/C#, you can see that you have to set the ApplicationId and AdUnitId property of each AdControl control in your app. The AdUnitId can only be set when the AdControl is instantiated using the default constructor. This sample application shows a way on how to set the AdUnitId during runtime.

For testing purposes, Microsoft has defined an ApplicationId and several AdUnitId. These values are required in case you have no ids created in the pubCenter for yourself or in case you want to test your app in the emulator.

Having the AdControl defined in XAML using these test values, you cannot change them later on during runtime to your production values. Means, you have to have two different XAML versions: one for testing purposes and one for production.

This sample application shows a way on how to avoid this. It offers an approach on how to set the AdUnitId during runtime. This makes it easy to configure the ids in a config file, switch between test and production values without always have to change the XAML.

The app contains the zipped sample code, so you do not need to download it separately from a web page.