No, there is no direct way of determining whether the its that is current is the last one. A simple Linq Last()
on the collection view will find you the last item. Please note, that the Linq Last
will not necessarily enumerate the entire collection. If the collection being enumerated supports the IList
interface or similar it will be able to locate the last item directly - see the example implementation here.
WPF CollectionViewSource: Is current record last?
-
18-03-2022 - |
Question
Using CollectionViewSource, is there a "direct" way of knowing if the current record is last one, without doing the comparatively heavy operation of enumerating through all the items to count them (even LINQ would do the same)? I need to enable/disable my navigation buttons depending upon the current position.
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow