Jay Kannan
Jay Kannan

Reputation: 1274

Detecting a scroll event in GridView (Windows 8)

How do we detect a scrolling event in GridView (like ViewChanged on ScrollViewer) on somethig like the default GridView template sample app? I'd like to replicate the effect that the netflix App does on the left red strip.

I tried putting the GridView inside a scrollviewer, but I've been unsuccessful at stretching it to fill the screen for different resolutions.

Update: I intend to use this with VariableGrid control that's on NuGet - though it's not an official control, it inherits GridView

Upvotes: 3

Views: 4240

Answers (3)

Arctic Vowel
Arctic Vowel

Reputation: 1522

There is a simpler way.

Edit a template of the GridView, and look inside the XAML to find a ScrollViewer which is a component of the GridView.

The ScrollViewer has a ViewChanged event that you can subscribe to. Now whenever the GridView is scrolled, this event will be fired.

Upvotes: 1

Jay Kannan
Jay Kannan

Reputation: 1274

The best way to do this seems that you can read through the components of the control, and assign events to it. based on what's happening in this example

http://mikaelkoskinen.net/post/WinRT-XAML-Automatically-Scrolling-ListView-to-Bottom-and-Detecting-When-ListView-is-Scrolled.aspx

I grabbed access to the scrollbar, suing the VisualTreeExtensions and I could capture the event Scroll, just like in the example. I had to read the children when the Loaded event of the grid was fired.

Upvotes: 1

Hermit Dave
Hermit Dave

Reputation: 3046

Try ManipulationCompleted and PointerReleased events on GridView. This is just using keyboard mouse..

Upvotes: 0

Related Questions