My data comes into the form sorted by my data’s Id. If I click the ColumnManagerCell, it will sort by ascending alphabetical, then by descending alphabetical, and then cycle back through all three. However, I want to eliminate the sort by Id.
I have my data correctly sorting in ascending alphabetical on load with the following code:
Binding bind = new Binding(); ListCollectionView lcv = new ListCollectionView(ObservableCollection<T>); lcv.SortDescriptions.Add(new SortDescription(“City”, ListSortDirection.Ascending)); bind.Source = lcv; this.MyGrid.SetBinding(DataGridControl.ItemsSourceProperty, bind);
Then, when I click the ColumnManagerCell, I switch to descending, which I want. However, my next click returns to the sort by Id. How can I eliminate the sort by Id completely, or how can I programmatically (in c# or xaml) trigger a sort based on clicking on the ColumnManagerCell?
Merci en avance,
Imported from legacy forums. Posted by Neil (had 598 views)
The default behavior is to change to SortDirection.Ascending -> SortDirection.Descending –> SortDirection.None. When you see it sorts by id, it is actually SortDirection.None. I don’t think there is a way to overwrite that behavior in 1.2. Maybe the behavior should be configurable via an additional property. I think it’s a nice feature to have in the next version of DataGrid.
Imported from legacy forums. Posted by nat (had 312 views)