Reputation: 23
I have a list object. Properties in "Score" class are int(PlayerId, ScoreId, TrialId)
List<Score> scList;
PlayerId ScoreId TrialId
Player1 25 1
Player2 28 1
Player1 34 2
Player2 21 2
Gridview desired Output:
TrialId Player1 Player2
1 25 28
2 34 21
I tried datatable (add dynamic columns), but it doesn't show up in any namespace. Is there any other way without using datatable?Do i need modified list of scList in order to achieve the desired output.
<GridView x:Name="GrdScore" HorizontalAlignment="Left">
<GridView.HeaderTemplate>
<DataTemplate>
<TextBlock Text="{ Binding PlayerId}"></TextBlock>
</DataTemplate>
</GridView.HeaderTemplate>
<GridView.ItemTemplate>
<TextBlock Text="{Binding ScoreId}"></TextBlock>
</GridView.ItemTemplate>
</GridView>
Upvotes: 1
Views: 910
Reputation: 31724
The GridView
in WinRT/XAML is not the same as a GridView
in WPF. Its layout is actually more akin to the Windows 8 start screen.
There is no grid/table control built into WinRT/XAML and so a better choice for you might be a ListView
control with statically specified column widths.
You might also look around to see if there are some commercial or open source implementation of a DataGrid
for Windows 8.
Check this related answer as well:
Create a table (DataGrid) in Windows 8 metro apps (C#/XAML)
Upvotes: 1