I have a DataGrid bound to a DataTable. For various reasons, I don't want to allow users to sort the data, but I want to sort the data once by "Username" as well as resize the columns.
I use DataTable.DefaultView.Sort = "Username" before binding it to DataGrid.
If I then create a DataGridTableStyle to set column widths for my DataGrid and add it to DataGrid, it overwrites the DataGrid's AllowSorting setting.
If I then set DataGridTableStyle.AllowSorting = False, it reverts back my sorting on DataTable for some reason. This behavior is undocumented and not mentioned anywhere on the web. The AllowSorting from DataGrid doesn't behave this way, so why the silliness? How do I get around it?