Xaml 为Windows Phone 8应用程序向Visual Studio sln添加广告

Xaml 为Windows Phone 8应用程序向Visual Studio sln添加广告,xaml,windows-phone-8,unity3d,visual-studio-2013,ads,Xaml,Windows Phone 8,Unity3d,Visual Studio 2013,Ads,我在Unity中制作了一个游戏,希望在Windows Phone 8的应用程序中添加广告。我遵循了网站上的说明: 不起作用的部分是这两行代码 Grid grid = (Grid)this.LayoutRoot.Children[1]; grid.Children.Add(adControl); 我在mainpage.xaml上没有网格,也不确定实现它的正确方法。如果有人能帮我展示我的主页应该是什么样子,我会很乐意的!这是它当前显示的内容: <phone:PhoneApplicationP

我在Unity中制作了一个游戏,希望在Windows Phone 8的应用程序中添加广告。我遵循了网站上的说明:

不起作用的部分是这两行代码

Grid grid = (Grid)this.LayoutRoot.Children[1];
grid.Children.Add(adControl);
我在mainpage.xaml上没有网格,也不确定实现它的正确方法。如果有人能帮我展示我的主页应该是什么样子,我会很乐意的!这是它当前显示的内容:

<phone:PhoneApplicationPage 
x:Class="MagicTapBall.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}" Orientation="Portrait" SupportedOrientations="PortraitOrLandscape" BackKeyPress="PhoneApplicationPage_BackKeyPress" OrientationChanged="PhoneApplicationPage_OrientationChanged">

<!--LayoutRoot is the root grid where all page content is placed-->
<DrawingSurfaceBackgroundGrid x:Name="DrawingSurfaceBackground" Loaded="DrawingSurfaceBackground_Loaded">

</DrawingSurfaceBackgroundGrid>


为什么不添加一个网格来保存所需内容和绘图面?这是我想做的,但我不确定是否要这样做。代码看起来像是将“广告系统”广告给网格的子级。你有一个如何制作网格系统的例子吗?