Select to view content in your preferred language

Datagrid Sorting

585
0
05-11-2010 05:19 AM
RobertMEIER
Regular Contributor
I have used the code that Rex put on the forum to populate a datagrid dynamically with features:

        For Each kv As KeyValuePair(Of String, String) In fsetSelected.FieldAliases

            Dim dataGridColumn As New DataGridTextColumn()

            Dim b As New Binding("Attributes")
            b.Converter = New DictionaryConverter()
            b.ConverterParameter = kv.Key
            dataGridColumn.Binding = b
            dataGridColumn.SortMemberPath = kv.Value
            dataGridColumn.CanUserSort = True
            dataGridColumn.Header = kv.Value

            selectDetailsDataGrid.Columns.Add(dataGridColumn)
        Next

But the control will not allow me to sort. As you can see I have set the SortMemberPath and CanUserSort to each column, but no luck. Also have the CanUserSortColumns property set to true in the XAML for the DataGrid.

Any help is appreciated.

Robert Meier
0 Kudos
0 Replies