我有以下代码:
<PivotItem
x:Uid="PivotDraw"
Margin="19,14.5,0,0"
Header="drawx"
DataContext="{Binding Draw}"
d:DataContext="{Binding Draws[0], Source={d:DesignData Source=/DataModel/SampleData.json, Type=data:DataSource}}"
CommonNavigationTransitionInfo.IsStaggerElement="True">
<!--Double line list with text wrapping-->
<ListView
ItemsSource="{Binding Rounds}"
IsItemClickEnabled="True"
ItemClick="ItemView_ItemClick"
ContinuumNavigationTransitionInfo.ExitElementContainer="True">
<ListView.ItemTemplate>
<DataTemplate>
<StackPanel Margin="0,0,0,9.5">
<TextBlock
Text="{Binding RoundNumber}"
TextWrapping="Wrap"
Pivot.SlideInAnimationGroup="1"
CommonNavigationTransitionInfo.IsStaggerElement="True"
Style="{ThemeResource ListViewItemTextBlockStyle}"
Margin="0,0,19,0"/>
<ListView ItemsSource="{Binding Formations}">
<ListView.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Shorthand}"></TextBlock>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackPanel>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</PivotItem>
这给了我我想要返回的所有数据,但不是我想要的布局。我得到(括号中是投标属性:
1 (round number)
A (formation shorthand)
B (formation shorthand)
C (formation shorthand)
2
D
E
F
当我在寻找:
Round 1
A, B, C
Round 2
D, E, F
显然 ListView 是错误的使用方法,可能适用于单个回合但不能在单行上显示编队,主要是担心此时显示我需要的数据,但我现在不确定我是什么控制之后得到我想要的结果。