Search code examples
c#.netxamlwindows-phone

Separator Between Items in LongListSelector on WP


I Have a LongListSelector which is bonded to a contact list , i would like to add a little line to separate each contacts .

Here is my 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> 

But there is no red line between the items, how can I add one?

EDIT :

Does it have to do with the fact that the orientation of my StackPanel is Horizontal?


Solution

  • Yes, it's because of the "Horizontal".

    Try this:

        <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>