将可见性设置为折叠的gridrow仍然保留黑点

时间:2012-02-06 11:38:15

标签: windows-phone-7 xaml

我正在尝试为我的全景视图放置广告网格。

问题在于,当我试图通过将可见性设置为折叠来隐藏广告网格时(当应用不是'试用'时),我再也看不到广告了,但我看到了一个预留的黑色空间广告的大小。这是我的代码:

    <phone:PhoneApplicationPage xmlns:my1="clr-namespace:Google.AdMob.Ads.WindowsPhone7.WPF;assembly=Google.AdMob.Ads.WindowsPhone7"  xmlns:my="clr-namespace:adMob7;assembly=adMob7"  
    x:Class="WP7SQLiteClient._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:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:local="clr-namespace:WP7SQLiteClient"
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="696"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait"  Orientation="Portrait"
    shell:SystemTray.IsVisible="True">
    <phone:PhoneApplicationPage.Resources>

    </phone:PhoneApplicationPage.Resources>
        <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" Background="Transparent">
        <!--Pivot Control-->
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>

        <controls:Panorama Grid.Row="0" x:Name="panoramaMain" SelectionChanged="Panorama_SelectionChanged">
            <controls:PanoramaItem Header="messages">


            </controls:PanoramaItem>
            <controls:PanoramaItem Header="share">

            </controls:PanoramaItem>
        </controls:Panorama>

      <Grid Grid.Row="1" Background="Yellow" x:Name="grid" Margin="0" Visibility="Collapsed" >
    <adduplex:AdControl x:Name="ad" Margin="0" xmlns:adduplex="clr-namespace:AdDuplex;assembly=AdDuplex.AdControl.Silverlight"
                        AppId="7671" 
                        />
        </Grid>
    </Grid>


</phone:PhoneApplicationPage>

如何在不保留黑色空间的情况下隐藏或移除广告?

1 个答案:

答案 0 :(得分:1)

确保包含控件的网格行也将崩溃:

<Grid>
    <Grid.RowDefinitions>
        <RowDefinition Height="*"/>
        <RowDefinition Height="auto"/>
    </Grid.RowDefinitions>
    <myControl Grid.Row="1" />
</Grid>

包含控件的第二行现在将崩溃。当高度设置为“*”时,该行仍然是“可见的”。