I would like to be able to sort the order of the rows in the XamDataGrid based on the rows source data.
How would I go about doing this with the XamDataGrid, I have been able to do this in the past with both Telerik, and DevExpress grid controls but there does not seem to be a way to do this with the XamDataGrid.
Hello Ryan,
I am just checking if you require any further assistance on the matter.
I have been looking into your question and I can suggest you look into the following forum thread where Stefan has shown how to use the CollectionViewSource in order to achieve ‘sorting in the data source’ :
http://ko.infragistics.com/community/forums/t/63244.aspx
Let me know, if you need any further assistance on this matter.
The manual sorting is not really that manual XamDataGrid expects that I will populate the sort descriptions which will allow me to specify different columns other than the one that is clicked but that is not enough for me.
I need to be able to sort by properties on the items in the data source that are not shown in a field on the XamDataGrid.
As for the UseCollectionView how do I start the sorting when i click on a label? When you set the SortEvaluationMode="UseCollectionView" the label click action is set to nothing and does not do anything.
One more thing all my fields are unbound fields.
What do you mean by "sort the DataRecords/Records directly"?
You can use manual sorting, and EventArgs of Sorting event - which contains the SortDirection.Direction, and Field.Name.
Ok this solutions sounds like it might work but I have already tried to use it an cannot figure out how to get the labels (column/field headers) to set the sort direction on click. I still want this to work like SortEvaluationMode="Auto" where you click on the header but the sorting is from the custom sort on the ListCollectionView.
Is there a way to sort the DataRecords/Records directly?
And just a thought for the future. The IComparer that you can attach to the field settings would work perfectly for this if the cellinfo was passed in with a reference to the DataRecord maybe if you added a new SortComparisonType of Record.