Alex
Alex

Reputation: 11147

gridrow that has visibility set to collapsed, still reserves a black spots

I am trying to place an ad grid for my panorama view.

The problem is that when i'm trying to hide the ad grid by setting the visibility to collapsed(when the app isn't 'trial'), i can't see the ad anymore but i see a reserved black space the size of the ad. Here is my code:

    <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>

How can i hide or remove the ad without having the black space reserved?

Upvotes: 0

Views: 1694

Answers (1)

Emond
Emond

Reputation: 50682

Make sure that the Grid Row that contains the control will collapse too:

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

The second row containing the control will now collapse. When the Height is set to "*" the row will still be 'visible'.

Upvotes: 1

Related Questions