Reputation: 479
on WinRT, I have a gridview. I want to execute a method when the end of the gridview is reached.
However, there is no event method like that for a gridview.
I try to detect a manipulation of the gridview, but seems the scrollviewer included in my gridview catch all the events. How can I get this scrollviewer ? And even after, with my scrollViewer, how can i know the position of this scrollviewer (reachedEnd for example ?)
Thanks
Upvotes: 2
Views: 1195
Reputation: 31724
You can use VisualTreeHelper
to find a descendant of the GridView
of type ScrollViewer
, then subscribe to its ViewChanged
event. In the event handler you can detect where you are in the ScrollViewer
. You would then compare the ScrollViewer.ScrollableWidth
with HorizontalOffset
to see if you have reached the end.
Use it if you want to drive some custom layout/animation logic, but do use ISupportIncrementalLoading
though as chue x suggested if what you are trying to do is load more data.
Upvotes: 5