我想在页面的 TopAppBar 中添加一个广告单元。
<Page.TopAppBar>
<AppBar IsOpen="True">
<UI:AdControl
AutoRefreshIntervalInSeconds="60"
ApplicationId="be1500d6-9ca7-4a0b-a479-0db279d71e14"
AdUnitId="11191335"
HorizontalAlignment="Center"
IsAutoRefreshEnabled="True"
VerticalAlignment="Top"
Width="320"
Height="50" IsAutoCollapseEnabled="True"
/>
</AppBar>
</Page.TopAppBar>
这可以编译和运行,没有错误,但是将其添加到我的代码后,Frame.导航到此页面返回一个 false 值。如何更正它以使导航成功?如果这不是正确的方法,那么我怎样才能让我的广告即使在滚动时也始终保持在页面顶部。
Windows
Phone不支持顶级AppBar。如果要在页面顶部显示添加项,请将其放在页面顶部的网格行中。将要滚动的页面内容放在其下方的第二行中。像这样:
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="50"/>
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<UI:AdControl Grid.Row="0" />
<GridView Grid.Row="1" /> <!-- or whatever else you want for the page content -->
</Grid>