我建议使用ItemsControl.默认ItemsControl显示垂直StackPanel包含TextBlock集合中每个项目的垂直.您可以根据需要覆盖ItemsControl要显示的默认模板.
这是一个编辑默认值ItemTemplate以显示为两个TextBlock而不是一个TextBlocks的示例:
<ItemsControl ItemsSource="{Binding MyCollection}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel>
<TextBlock Text="{Binding Link}" Style="{StaticResource LinkTextStyle}" />
<TextBlock Text="{Binding Description}" />
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
711 次 |
| 最近记录: |