I am using a xamGrid on a "paging" data source via an implementation of IList that calls the underlying dataprovider with paramters based on the index of the record being requested by the grid.
All works fine when displaying the grid, the grid calls my IList indexer one row at time only for the rows it is trying to display on the screen (and a couple of others) and my indexer can call the datasource as required.
Now I need to implement sorting, the xamGrid the xamGrid calls my IList indexer for every index from 0 to the number of rows, then sorts the data its self.
I developed an IBindingList class which has sorting methods in the interface, but xamGrid still just wants to ask for every single record and perform its own sort.
The problem is there are many millions of records... I need the xamGrid to ask for the datasource to be sorted when the user clicks a column to sort.
How can I do that? Is there an interface with sorting methods that xamGrid will recognise?
If I trap the sorting event, do the sort, update the datasource property and cancel, then xamGrid does not provide a visual indication that the column is sorted.
Any ideas?
Hello,
You are correct. The grid is tied tightly to the sort of the records so when you cancel the sort, even though you sort your self, you get no indication. I have provided a sample which will get you around this. I Created my own CustomSortField which inherits from the Field object and added a CustomSortStatus property and a CustomSortIndicatorVisibility property. Then, in xaml, I add my custom Field to the Fields collection. Then, in a style for the LabelPresenter I bind the Visibility and SortStatus properties to these new fields respectively.
I hope this is a viable solution for you. Please let me know.