I bound a ListView to a List(Of List(Of Integer)).
I can specify the columns thus:
<ListView ItemsSource="{Binding ResultsByDenomination}">
<ListView.View>
<GridView>
<GridViewColumn Header=" "/>
<GridViewColumn Header="Noord" DisplayMemberBinding="{Binding [0]}"/>
<GridViewColumn Header="Oost" DisplayMemberBinding="{Binding [1]}"/>
<GridViewColumn Header="Zuid" DisplayMemberBinding="{Binding [2]}"/>
<GridViewColumn Header="West" DisplayMemberBinding="{Binding [3]}"/>
</GridView>
</ListView.View>
This lays out the ListOfList neatly in a square grid.
However, I want to fill the first column with fixed values.
How do I do that, apart from rebuilding the ListOfListOf Integer to a ListOfList Of string and add the first column with fixed values there?
EDIT: Basically I want to add RowHeaders.
If you have one data structure for the row headers and another one for the row data, simply transform the data into a new data structure that is easily consumable by the
ListViewby combining them. Since you seem to like “nuts and bolts” data structures, you can use aList<Tuple<string, List<int>>>for this.Here is a simple example. First the code-behind to simulate your
ResultsByDenominationproperty:and the modified XAML to support the new data structure:
You can also create a utility class instead of using
Tuplewith more descriptive names.