我有一个绑定到联系人列表的LongListSelector,我想添加一行来分隔每个联系人。
这是我的xaml:
<phone:LongListSelector>
<phone:LongListSelector.ItemTemplate>
<DataTemplate>
<StackPanel Orientation = "Horizontal" >
<TextBlock Text="{Binding informations}" Height="120" />
<Image Source="{Binding photo}" Height="90" Width="90" />
<Line Fill="Red" Height="2" />
</StackPanel>
</DataTemplate>
</phone:LongListSelector.ItemTemplate>
</phone:LongListSelector>
但是项目之间没有红线,我该如何添加一个?
编辑:
是否与StackPanel的方向是水平的这一事实有关?
答案 0 :(得分:0)
是的,这是因为“水平”。
试试这个:
<phone:LongListSelector>
<phone:LongListSelector.ItemTemplate>
<DataTemplate>
<StackPanel>
<StackPanel Orientation = "Horizontal" >
<TextBlock Text="{Binding informations}" Height="120" />
<Image Source="{Binding photo}" Height="90" Width="90" />
</StackPanel>
<Line Fill="Red" Height="2" />
</StackPanel>
</DataTemplate>
</phone:LongListSelector.ItemTemplate>
</phone:LongListSelector>
答案 1 :(得分:0)
在我的情况下,上述解决方案不起作用,因此这是一个替代解决方案:
<phone:LongListSelector>
<phone:LongListSelector.ItemTemplate>
<DataTemplate>
<StackPanel>
<StackPanel>
<TextBlock Text="{Binding informations}" Height="120" />
<Image Source="{Binding photo}" Height="90" Width="90" />
</StackPanel>
<Rectange Fill="Red" Height="2" width="120"/>
</StackPanel>
</DataTemplate>
</phone:LongListSelector.ItemTemplate>
</phone:LongListSelector>