Windows ストア アプリを作成しています。テーブルのような構造を作成したいので、ItemsControl を使用しました。テーブル内の文字列のリストのリストである指定された JSON の下に表示する必要があります。ここから何かを試しましたが、出力が繰り返されています。
JSON
{
head:[
[
"Your purchase",
"Short number",
"SMS text",
"Price",
"Operator"
]
],
body:[
[
"10",
"28000",
"PAY 2p+2508812",
"23.20 MXN",
"TELCEL"
],
[
"10",
"28000",
"PAY 2p+2508812",
"23.20 MXN",
"MOVISTAR"
],
[
"6",
"53035",
"dam 10169 2508812",
"15.08 MXN",
"IUSACELL"
],
[
"10",
"28000",
"PAY 2p+2508812",
"23.20 MXN",
"Nextel"
],
[
"10",
"28000",
"PAY 2p+2508812",
"23.20 MXN",
"Lusacell"
]
]
}
モデル クラス
public class SmsTable
{
[JsonProperty("head")]
public List<List<string>> Headers { get; set; }
[JsonProperty("body")]
public List<List<string>> RowValues { get; set; }
}
XAML
<ItemsControl x:Name="icOuter" Grid.Row="1" ItemsSource="{Binding RowValues}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<ItemsControl x:Name="icInner" ItemsSource="{Binding}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid HorizontalAlignment="Left">
<StackPanel Orientation="Horizontal" Background="White" HorizontalAlignment="Left">
<Border Style="{StaticResource BorderCell}">
<TextBlock Text="{Binding Items[0], ElementName=icInner}" Style="{StaticResource TextBlockCell}" Width="180"/>
</Border>
<Border Style="{StaticResource BorderCell}">
<TextBlock Text="{Binding Items[1], ElementName=icInner}" Style="{StaticResource TextBlockCell}" Width="180"/>
</Border>
<Border Style="{StaticResource BorderCell}">
<TextBlock Text="{Binding Items[2], ElementName=icInner}" Style="{StaticResource TextBlockCell}" Width="245"/>
</Border>
<Border Style="{StaticResource BorderCell}">
<TextBlock Text="{Binding Items[3], ElementName=icInner}" Style="{StaticResource TextBlockCell}" Width="125"/>
</Border>
<Border Style="{StaticResource BorderCell}">
<TextBlock Text="{Binding Items[4], ElementName=icInner}" Style="{StaticResource TextBlockCell}" Width="125"/>
</Border>
</StackPanel>
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
期待される出力
実際の出力