LongListSelector的ItemTemplate中的行不显示

时间:2014-09-11 12:55:31

标签: xaml windows-phone-8 line longlistselector

我正在尝试在我的商品之间添加分隔线,但该行未显示。你能救我一下吗?

<phone:LongListSelector.ItemTemplate>
    <DataTemplate>
        <StackPanel>
            <Grid
                                Height="50"
                                VerticalAlignment="Top">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"></ColumnDefinition>
                    <ColumnDefinition Width="*"></ColumnDefinition>
                </Grid.ColumnDefinitions>

                <TextBlock Grid.Column="0"
                                       x:Name="departureTime" 
                                       FontWeight="Bold" 
                                       FontSize="15"
                                       Margin="30,0,0,10"
                                       Foreground="#0145A6"  
                                       Text="{Binding departureTime}" 
                                       Height="30"  
                                       HorizontalAlignment="Left" 
                                       Width="auto"/>

                <TextBlock Grid.Column="1"
                                       FontWeight="Bold" 
                                       Foreground="#0145A6" 
                                       FontSize="15" 
                                       x:Name="stopName" 
                                       Text="{Binding wheelChairId}" 
                                       FontFamily="/Fonts/icomoon.ttf#icomoon"
                                       HorizontalAlignment="Right" 
                                       Width="auto" 
                                       Height="31"
                                       Margin="0,0,30,0"/>
            </Grid>
            <Line Fill="Black" Height="1"/>
        </StackPanel>
    </DataTemplate>
</phone:LongListSelector.ItemTemplate>

1 个答案:

答案 0 :(得分:1)

您可以使用拉伸使您的Line占据容器的整个宽度。您还可以使用左/右边距在每侧添加一点空间:

XAML:

<Line X1="0" X2="1" Stroke="Brown" StrokeThickness="10" Height="auto" Width="auto" Stretch="Fill"/>