Reputation: 1222
I have a DataGrid in WPF with autogenerated columns.
How can I disable sorting functionality of all the rows following the MVVM pattern?
<DataGrid AutoGenerateColumns="True"
ItemsSource="{Binding MyList}">
</DataGrid>
Upvotes: 13
Views: 17015
Reputation: 81253
Set CanUserSortColumns="False"
on dataGrid which will disable sorting for all columns.
<DataGrid AutoGenerateColumns="True"
ItemsSource="{Binding MyList}"
CanUserSortColumns="False">
</DataGrid>
Upvotes: 50