簡體   English   中英

WP上LongListSelector中項目之間的分隔符

[英]Separator Between Items in LongListSelector on WP

我有一個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的方向是水平的事實有關嗎?

是的,這是因為“水平”。

嘗試這個:

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

就我而言,上述解決方案不起作用,因此這是另一種解決方案:

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM