如何在列表中的每一行之间绘制线条?

时间:2013-11-26 11:11:05

标签: xaml windows-phone-7

下面给出的是使用获取列表的每一行的代码,

<ListBox x:Name="List" HorizontalAlignment="Left" Height="575" Margin="6,0,0,0" VerticalAlignment="Top" Width="443" SelectionChanged="List_SelectionChanged_1">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal" Width="430" Height="80">
                        <Grid Margin="0,0,0,0" Height="90" Width="305">
                            <TextBlock HorizontalAlignment="Left" Height="60" Margin="0,0,0,0" FontWeight="Medium" TextWrapping="Wrap" Text="{Binding Name}" VerticalAlignment="Top" Width="268" FontSize="25"/>
                            <TextBlock HorizontalAlignment="Left" Height="60" Margin="0,36,0,-1" TextWrapping="Wrap" Text="{Binding TaxType}" VerticalAlignment="Top" Width="259" Foreground="Gray" FontSize="16"/>
                        </Grid>
                        <StackPanel Orientation="Horizontal" Margin="0,0,0,0" FlowDirection="RightToLeft" Grid.Row="0" Width="125" HorizontalAlignment="Right">
                            <TextBlock Text="{Binding Percentage}"  FontSize="23" VerticalAlignment="Center" HorizontalAlignment="Right" FontFamily="Portable User Interface" Height="75"/>
                        </StackPanel>
                    </StackPanel>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>

现在如何在此堆栈面板的末尾绘制一条线(即列表中的每一行之间)

2 个答案:

答案 0 :(得分:1)

您需要做的是,在堆叠面板中添加当前数据,然后添加上一个答案中提到的路径,并将这两个放在一个堆栈面板中 Orientation = Horizo​​ntal

答案 1 :(得分:0)

在StackPanel下面的所有其他内容中,应用:

<Path Data="M0,0 L1,1 M0,1 L1,0" Stretch="Uniform" Stroke="Red" />