2014-09-11 71 views
0

我想在我的項目之間添加一個分隔符行,但行不顯示。你能幫我嗎?Line in LongListSelector的ItemTemplate Does not Show Up

<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

您可以使用拉伸,使您的行佔據容器的整個寬度。您還可以使用左/右頁邊距在每邊加少許空間:

XAML:

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