有沒有簡單的方法來定位一個全景內的AdControl?現在,我只能讓我的廣告控制顯示,如果設置我的對象樹像這樣:WP7 - 定位AdControl
Layout Root > Panorama > ...
> AdControl1
也就是說,既有我的全景和我的廣告控制爲LayoutRoot的直接孩子。
我只是想表明我的廣告控制第一PanoramaItem,但我這樣做的時候,就無法呈現:
LayoutRoot > Panorama > PanoramaItem > StackPanel > ListBox
> AdControl
也就是說,我希望我的廣告控制成爲我的列表框的下方,貼在僅在PanoramaItem的底部。我錯過了什麼?
編輯:的XAML,額外PanoramaItems省略
工作
<!--LayoutRoot is the root grid where all page content is placed-->
<Grid x:Name="LayoutRoot" Background="Transparent">
<!--Panorama control-->
<controls:Panorama Title="bad religion">
<controls:Panorama.Background>
<ImageBrush ImageSource="PanoramaBackground.png"/>
</controls:Panorama.Background>
<!--Panorama item one-->
<controls:PanoramaItem Header="content">
<!--Double line list with text wrapping-->
<ListBox x:Name="LyricsListBox" Margin="0,0,-12,0" ItemsSource="{Binding Items}" SelectionChanged="LyricsListBox_SelectionChanged">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Margin="0,0,0,17" Width="432" Height="78">
<TextBlock Text="{Binding LineOne}" TextWrapping="Wrap" Style="{StaticResource PhoneTextExtraLargeStyle}"/>
<TextBlock Text="{Binding LineTwo}" TextWrapping="Wrap" Margin="12,-6,12,0" Style="{StaticResource PhoneTextSubtleStyle}"/>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</controls:PanoramaItem>
</controls:Panorama>
<my:AdControl AdUnitId="TextAd" ApplicationId="test_client" Height="80" HorizontalAlignment="Left" Margin="0,720,0,0" Name="adControl1" VerticalAlignment="Top" Width="480" />
</Grid>
不工作
<!--LayoutRoot is the root grid where all page content is placed-->
<Grid x:Name="LayoutRoot" Background="Transparent">
<!--Panorama control-->
<controls:Panorama Title="bad religion">
<controls:Panorama.Background>
<ImageBrush ImageSource="PanoramaBackground.png"/>
</controls:Panorama.Background>
<!--Panorama item one-->
<controls:PanoramaItem Header="content">
<StackPanel>
<!--Double line list with text wrapping-->
<ListBox x:Name="LyricsListBox" Margin="0,0,-12,0" ItemsSource="{Binding Items}" SelectionChanged="LyricsListBox_SelectionChanged">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Margin="0,0,0,17" Width="432" Height="78">
<TextBlock Text="{Binding LineOne}" TextWrapping="Wrap" Style="{StaticResource PhoneTextExtraLargeStyle}"/>
<TextBlock Text="{Binding LineTwo}" TextWrapping="Wrap" Margin="12,-6,12,0" Style="{StaticResource PhoneTextSubtleStyle}"/>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<my:AdControl AdUnitId="TextAd" ApplicationId="test_client" Height="80" HorizontalAlignment="Left" Margin="0,720,0,0" Name="adControl1" VerticalAlignment="Top" Width="480" />
</StackPanel>
</controls:PanoramaItem>
</controls:Panorama>
</Grid>
我們在全景圖上使用了廣告控件,沒有任何問題。這將有助於查看您的XAML頁面。可能是ListBox將adcontrol從頁面底部推出,以至於看不到它。另外,如果adcontrol配置不正確,您可能看不到任何內容,因爲它在沒有內容顯示時會自動摺疊。 –
@WaltRitscher:很高興聽到!我已經用我當前的工作和非工作代碼更新了我的帖子。如果這件事很明顯,我表示歉意,我現在只做了一週的微軟開發! – Josh