This is a follow up question from an earlier post (here).
I have some 'header' information stored as:
Dictionary<string,string>
- where the first string represents the field name, and the second the heading I want displayed.
I have a set of dynamic data that is stored as:
Dictionary<string, object>
- where string is the field name.
I bind to this in xaml as:
<data:DataGrid Name="_dataGrid" AutoGenerateColumns="True" IsReadOnly="False" Margin="5" Height="200">
<data:DataGrid.Columns>
<data:DataGridTextColumn Header="Forename" CanUserSort="True" SortMemberPath="Forename"
Binding="{Binding Converter={StaticResource RowIndexConverter},
ConverterParameter=Forename}"/>
<data:DataGridTextColumn Header="Surname" CanUserSort="True" SortMemberPath="Surname"
Binding="{Binding Converter={StaticResource RowIndexConverter},
ConverterParameter=Surname}"/>
<data:DataGridTextColumn Header="Age" CanUserSort="True" SortMemberPath="Age"
Binding="{Binding Converter={StaticResource RowIndexConverter},
ConverterParameter=Age}"/>
<data:DataGridTextColumn Header="Shoesize" CanUserSort="True" SortMemberPath="Shoesize"
Binding="{Binding Converter={StaticResource RowIndexConverter},
ConverterParameter=Shoesize}"/>
</data:DataGrid.Columns>
</data:DataGrid>
Problem 1 I want to autogenerate these columns (using the header information supplied)
Problem 2 I want the columns to be generated based on what datatype they are (i.e. boolean = checkbox)
Problem 3 Ideally I would also like to specify weather a button should exist in the first column or not (i.e. an edit / view button) via databinding