拉伸行内容以填充空白区域

时间:2015-02-11 16:15:55

标签: xaml windows-phone-8

我无法让这个工作。我有一个显示一些信息的页面,我将其分为6行。我希望每一行都像他们现在一样占用空间,但是最新的一行(有一张地图和一张图像)占据了所有空间,直到它填满空间。

这是我的xaml:

<phone:PhoneApplicationPage
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"
xmlns:Maps="clr-namespace:Microsoft.Phone.Controls.Maps;assembly=Microsoft.Phone.Controls.Maps" 
xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
xmlns:UI="clr-namespace:Microsoft.Advertising.Mobile.UI;assembly=Microsoft.Advertising.Mobile.UI"
x:Class="MyApp.EventMoreInfoNoPhoto"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="Portrait" Orientation="Portrait"
mc:Ignorable="d"
shell:SystemTray.IsVisible="True">
<StackPanel  x:Name="swippingSurface">
    <Grid x:Name="LayoutRoot" 
          HorizontalAlignment="Stretch" 
          Margin="0,0,0,0"        
          VerticalAlignment="Stretch"
          Background="Transparent">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="1*"/>
            <ColumnDefinition Width="1*"/>
            <ColumnDefinition Width="1*"/>
            <ColumnDefinition Width="1*"/>
            <ColumnDefinition Width="1*"/>
            <ColumnDefinition Width="1*"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Border Grid.Row="0"
                Grid.ColumnSpan="6"
                BorderThickness="0"
                BorderBrush="DarkRed">
            <Border.Background>
                <LinearGradientBrush EndPoint="1,0" StartPoint="1,1">
                    <GradientStop Color="DarkRed" Offset="0" />
                    <GradientStop Color="DarkRed" Offset="1" />
                </LinearGradientBrush>
            </Border.Background>
        </Border>
        <Border Grid.Row="1" 
                Grid.Column="0" 
                Grid.ColumnSpan="1"
                BorderThickness="0"
                BorderBrush="Red">
            <Border.Background>
                <LinearGradientBrush EndPoint="1,0" StartPoint="1,1">
                    <GradientStop Color="Red" Offset="0" />
                    <GradientStop Color="Red" Offset="1" />
                </LinearGradientBrush>
            </Border.Background>
        </Border>
        <Border Grid.Row="2" 
                Grid.Column="0" 
                Grid.ColumnSpan="1"
                BorderThickness="0"
                BorderBrush="Red">
            <Border.Background>
                <LinearGradientBrush EndPoint="1,0" StartPoint="1,1">
                    <GradientStop Color="Red" Offset="0" />
                    <GradientStop Color="Red" Offset="1" />
                </LinearGradientBrush>
            </Border.Background>

        </Border>
        <Border Grid.Row="3" 
                Grid.Column="0" 
                Grid.ColumnSpan="1"
                BorderThickness="0"
                BorderBrush="Red">
            <Border.Background>
                <LinearGradientBrush EndPoint="1,0" StartPoint="1,1">
                    <GradientStop Color="Red" Offset="0" />
                    <GradientStop Color="Red" Offset="1" />
                </LinearGradientBrush>
            </Border.Background>
        </Border>
        <Border Grid.Row="4" 
                Grid.Column="0" 
                Grid.ColumnSpan="1"
                BorderThickness="0"
                BorderBrush="Red">
            <Border.Background>
                <LinearGradientBrush EndPoint="1,0" StartPoint="1,1">
                    <GradientStop Color="Red" Offset="0" />
                    <GradientStop Color="Red" Offset="1" />
                </LinearGradientBrush>
            </Border.Background>
        </Border>
        <Border Grid.Row="5" 
                Grid.Column="0" 
                Grid.ColumnSpan="1"
                BorderThickness="0"
                BorderBrush="Red">
            <Border.Background>
                <LinearGradientBrush EndPoint="1,0" StartPoint="1,1">
                    <GradientStop Color="Red" Offset="0" />
                    <GradientStop Color="Red" Offset="1" />
                </LinearGradientBrush>
            </Border.Background>
        </Border>
        <Border Grid.Row="6" 
                Grid.RowSpan="2" 
                Grid.Column="0" 
                x:Name="photo_border"
                Grid.ColumnSpan="1"
                BorderThickness="0"
                BorderBrush="Red">
            <Border.Background>
                <LinearGradientBrush EndPoint="1,0" StartPoint="1,1">
                    <GradientStop Color="Red" Offset="0" />
                    <GradientStop Color="Red" Offset="1" />
                </LinearGradientBrush>
            </Border.Background>
        </Border>


        <Border Grid.Row="2" Grid.Column="1" 
            Grid.ColumnSpan="5"
            BorderThickness="0"
            Opacity="0.3"
            BorderBrush="DarkGray">
            <Border.Background>
                <LinearGradientBrush EndPoint="1,0" StartPoint="1,1">
                    <GradientStop Color="DarkGray" Offset="0" />
                    <GradientStop Color="DarkGray" Offset="1" />
                </LinearGradientBrush>
            </Border.Background>
        </Border>

        <Border Grid.Row="4" Grid.Column="1" 
            Grid.ColumnSpan="5"
            BorderThickness="0"
            Opacity="0.3"
            BorderBrush="DarkGray">
            <Border.Background>
                <LinearGradientBrush EndPoint="1,0" StartPoint="1,1">
                    <GradientStop Color="DarkGray" Offset="0" />
                    <GradientStop Color="DarkGray" Offset="1" />
                </LinearGradientBrush>
            </Border.Background>
        </Border>
        <Image HorizontalAlignment="Center" 
                   Grid.Row="0" 
                   Grid.Column="4" 
                   Source="/Resources/text_black.png" 
                   VerticalAlignment="Center" 
                   Width="40" 
                   Margin="0,0,0,0"/>
        <Image HorizontalAlignment="Center" 
                   Grid.Row="0" 
                   Grid.Column="5" 
                   Source="/Resources/big_map_white.png" 
                   VerticalAlignment="Center" 
                   Width="40" 
                   Margin="0,0,0,0"/>
        <TextBlock Text="Info"
                   VerticalAlignment="Center"
                   HorizontalAlignment="Center"
                   Grid.Column="0"
                   Margin="0,0,0,0"
                   Style="{StaticResource PhoneTextNormalStyle}"/>

        <Image HorizontalAlignment="Center" 
               Source="/Resources/label.png" 
               Height="65" 
               VerticalAlignment="Center" 
               Width="69" 
               Grid.Row="1" 
               Margin="0,0,0,0"/>
        <Image HorizontalAlignment="Center" 
               Height="65" 
               Grid.Row="2" 
               Source="/Resources/label.png" 
               VerticalAlignment="Center" 
               Width="69" 
               Margin="0,0,0,0"/>
        <Image HorizontalAlignment="Center" 
               Height="65"
               Grid.Row="3" 
               Source="/Resources/calendar.png"
               VerticalAlignment="Center" 
               Width="69"
               Margin="0,0,0,0"/>
        <Image HorizontalAlignment="Center"
               Height="65"
               Grid.Row="4" 
               Source="/Resources/calendar.png" 
               VerticalAlignment="Center" 
               Width="69" 
               Margin="0,0,0,0"/>
        <Image HorizontalAlignment="Center" 
               Height="65" 
               Grid.Row="5" 
               Source="/Resources/comment.png" 
               VerticalAlignment="Center" 
               Width="69" 
               Margin="0,0,0,0"/>
        <Image HorizontalAlignment="Center" 
               x:Name="map_icon"
               Height="65" 
               Grid.Row="6" 
               Source="/Resources/map_white.png" 
               VerticalAlignment="Center" 
               Width="69" 
               Margin="0,0,0,0"/>

        <TextBlock HorizontalAlignment="Left"
            x:Name="list_event_topic" 
            Grid.Column="1" 
            Margin="0,0,0,0" 
            TextWrapping="Wrap" 
            Text="" 
            Grid.Row="1"
            Grid.ColumnSpan="5"/>
        <TextBlock HorizontalAlignment="Left" 
            x:Name="list_event_title" 
            Grid.Column="1" 
            Margin="0,0,0,0" 
            Grid.Row="2" 
            Grid.ColumnSpan="5"
            TextWrapping="Wrap"
            Text=""/>
        <TextBlock HorizontalAlignment="Left"
            x:Name="date_init" 
            Margin="0,0,0,0" TextWrapping="Wrap" 
            Text=""
            VerticalAlignment="Top"  
            Grid.Row="3"
            Grid.Column="1"
            Grid.ColumnSpan="5"/>

        <TextBlock HorizontalAlignment="Left" 
            x:Name="date_end" 
            Margin="0,0,0,0" 
            TextWrapping="Wrap" 
            Text=""
            VerticalAlignment="Top"  
            Grid.Row="4"
            Grid.Column="1"
            Grid.ColumnSpan="5"/>

        <TextBlock Grid.Column="1"
            x:Name="comment_area" 
            HorizontalAlignment="Left" 
            Margin="10,10,0,0"
            Grid.Row="5" 
            TextWrapping="Wrap"
            Text="" 
            VerticalAlignment="Top"
            Grid.ColumnSpan="5"
                   />
        <Maps:Map x:Name="map_event_detail"
            Grid.ColumnSpan="5" 
            HorizontalAlignment="Stretch" 
            Margin="0,0,0,0" 
            Grid.Column="1"
            Tap="onTapMap"
            Grid.Row="6" 
            Width="auto"
            VerticalAlignment="Stretch"
            >
            <Maps:Pushpin x:Name="pinEvent"  
                Background="Green" 
                BorderBrush="Black" 
                BorderThickness="1" 
                Visibility="Collapsed" />
        </Maps:Map>

    </Grid>

</StackPanel>


</phone:PhoneApplicationPage>

但我的问题是,在地图结束后,有一些空的空间。我尝试在VerticalAligment中使用Stretch,但我不能。

我在这里做错了什么?我确信这是愚蠢的事。

0 个答案:

没有答案