I am using XamDataGrid 9.1 with record filter. I am looking for a property that given me the count of no. of records available in the grid at any point. XamDataGrid.Records.Count gives me total no of records. This always gives me the total no. of records.
What I am looking for is a property that gives the correct count of visible records when filters are applied.
You can use the GetFilteredOutDataRecords / GetFilteredInDataRecords methods to get the data records that do not match / match the filter criteria e.g.
IEnumerable<DataRecord> filteredInRecords=xamDataGrid1.RecordManager.GetFilteredInDataRecords();
Then you can cast to List and get the Count records.
Hope this helps
Vlad
I did try using it, but I canit get hold of changes to the count on subsequent updates ( for eg. when record filter is changed by user.) Is there a way I can detect changes to this count ? I tried PropertyChanged of RecordManager, it doesn't help.
While the GetFilteredInDataRecords method returns a snapshot, the FilteredInDataItems property returns a collection of the underlying dataitems (i.e. the items from the datasource) and is updated as the record filters are applied.
Thank you very much. GetFilteredInDataRecords is enough for me in this case. Basically I wanted the number of records visible to be bound to a label. I created a property and used RecordsInViewChanged event as well to get this done.
May be it would be good to have property which can be directly used for databinding.
Essentially we do via the property that I mentioned. Using the property I mentioned you can have a label showing the visible root records as follows and this avoids making a new list (or having to enumerate the results of the GetFilteredInDataItems with every RecordsInViewChanged event):
RecordsInViewChanged event does not fire when the filter produces zero results. How should we handle such cases? Thank you in anticipation.
This is correct, RecordsInViewChanged doesn't fire if filter record count is 0. :-( M facing this issue too! Any soulution for this? which event fires after filter is applied on XamDataGried?