0

I am trying to create a custom CardView control. I have a stack of cards (Grid with Image and TextBlock) and on swiping left or right I am moving the card left or right and on threshold I am removing the card. I am acheiving this using the Grid manipulation events. This behaviour works fine. But the issue is when I place this usercontrol (CardView) inside a scrollable page. For example, I have a page with a ScrollViewer and lot of contents with it and the last item of the page being the CardView. The page smoothly scrolls till the end. But when I try to scroll the page up, it takes the manipulation events of the Grid (within the CardView) because of which I am not able to scroll up.

The manipulation delta of the Grid is below: And I have written the code to remove the card in OnManipulationCompleted.

<Grid ManipulationCompleted="OnManipulationCompleted" 
      ManipulationDelta="OnManipulationDelta"   
      ManipulationStarted="Border_ManipulationStarted" 
      ManipulationMode="All">
     <Grid.RenderTransform>
          <CompositeTransform x:Name="transform" TranslateX="0" />
     </Grid.RenderTransform>
     // Image and TextBlock goes here
</Grid>

private void OnManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
{
    transform.TranslateX += e.Delta.Translation.X;
}

Any workaround?

Thank you

meetme
  • 203
  • 3
  • 12
  • One of these might help [Bubbling scroll events from a ListView to its parent](http://stackoverflow.com/questions/1585462/bubbling-scroll-events-from-a-listview-to-its-parent) or [WPF Remove ScrollViewer from TreeView](http://stackoverflow.com/questions/3498686/wpf-remove-scrollviewer-from-treeview) – Tone Apr 08 '16 at 05:33
  • I forgot to mention that my project is wp8.1 (WinRT). It does not have PreviewMouseWheel event – meetme Apr 08 '16 at 05:43
  • AH ok. I'm not familiar with WinRT but maybe the same basic principle applies? i.e. capture the event you're interested in, mark as handled then re-raise. Sorry just guessing, not sure if it even uses RoutedEvents. Possibly search for WinRT RoutedEvent and something might turn up as an alternative if not. – Tone Apr 08 '16 at 05:51

0 Answers0