我尝试在 longlistselector 的每个项周围使用边框来区分各个项。我尝试将 BorderThickness 属性添加到我的 longlistselector ,但它没有为我的列表项提供任何边框。
这是我的xaml文件
<Grid x:Name="LayoutRoot" Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28"/>
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<phone:LongListSelector HorizontalAlignment="Stretch" x:Name="lls_Text_SelectionList" ItemsSource="{Binding }" FontSize="36" Margin="0,10,0,88" HideEmptyGroups="True" Background="Gray" BorderBrush="Red" BorderThickness="10" />
</Grid>
</Grid>
我已经为 BorderThickness 和 BorderBrush 使用了各种值,但它没有给我任何边框。任何人都可以协助我解决这个问题吗?
答案 0 :(得分:1)
您需要一个ItemTemplate。像这样:
<phone:LongListSelector HorizontalAlignment="Stretch" x:Name="lls_Text_SelectionList" ItemsSource="{Binding }" " Margin="0,10,0,88" HideEmptyGroups="True" Background="Gray" >
<phone:LongListSelector.ItemTemplate>
<DataTemplate>
<Border BorderBrush="Red" BorderThickness="10">
<TextBlock Text="{Binding}" Style="{StaticResource PhoneTextLargeStyle}" />
</Border>
</DataTemplate>
</phone:LongListSelector.ItemTemplate>
</phone:LongListSelector>