Version

Accessing Records Through the RecordManager

One important task when displaying data is enumerating the underlying data. The DataPresenter controls contain a mechanism called RecordManager. The RecordManager makes it easier for you to access Records in different formats. For example, you can work with data in an unsorted format by using the RecordManager’s UnSorted option. The UnSorted option returns a read-only DataRecordCollection. You can then enumerate through this collection of DataRecords and search for key information from the Record’s Fields.

The RecordManager can also retrieve a collection of Sorted DataRecords. Sorted DataRecords are sorted in whichever order the end user sorts them. Use the IsSorted property off the RecordManager to check if the end user has sorted the Records.

The following pseudo code tests to see if the end user has sorted records or not. If the end user has sorted any records, an instance of DataRecordCollection is created and stores the sorted records for later access.

In C#:

DataRecordCollection myCollection;
RecordManager myManager = XamDataGrid1.RecordManager;
if (myManager.IsSorted)
{
    myCollection = myManager.Sorted;
}

In Visual Basic:

Dim myCollection As DataRecordCollection
Dim myManager As RecordManager = XamDataGrid1.RecordManager
If myManager.IsSorted Then
    myCollection = myManager.Sorted
End If