Reputation: 1100
I want to have slide feature on GridView
, so I use manipulation but it doesn't work, here is XAML code:
<GridView x:Name="DaysGridView" HorizontalAlignment="Right" IsItemClickEnabled="True"
ManipulationMode="All" ManipulationInertiaStarting="DaysGridView_ManipulationInertiaStarting"
ManipulationStarting="DaysGridView_ManipulationStarting"
ManipulationStarted="DaysGridView_ManipulationStarted"
ManipulationDelta="DaysGridView_ManipulationDelta"
ManipulationCompleted="DaysGridView_ManipulationCompleted"
ItemClick="DaysGridView_ItemClick"
SelectionChanged="DaysGridView_SelectionChanged">
When I am sliding with mouse, it works; but when I am sliding in "Basic touch mode" of Windows Simulator, it doesn't work; if I change GridView
to Grid
and add above manipulation events, it also works.
So, how can I make manipulation work in GridView
?
Upvotes: 0
Views: 1354
Reputation: 31724
I just asked the MS guys a similar question today and you can't do it in a simple way since the ScrollViewer in the GridView template captures touch input and you can't access these events. My solution is to overlay the control with a transparent rectangle that I capture all the input on and filter all inputs so I can either manipulate my child elements, the ScrollViewer or both. You do need to know how to translate these inputs into ScrollTo...Offset calls on the SV, which is not easy and then you might need to add your own ScrollBars etc. Check my earlier answer to similar question for more thoughts on that.
Upvotes: 1
Reputation: 1100
I find a solution for this case: just set ScrollViewer.HorizontalScrollMode="Disabled"
(I need slide horizontally), and then the manipulation works!
Upvotes: 0