ScrollViewer and child manipulation operations

I created a Windows 8 storage application using C # / XAML. My interface includes a scrollable list that is displayed with ScrollViewer. I would like to be able to handle manipulation events for items in a list, however setting ManipulationModefor anything other than Nonein a list item causes my list to no longer scroll.

Here is a simplified version of the user interface:

<ScrollViewer>
  <Border/> <!-- these contain child content -->
  <Border/>
  <Border/>
  <!-- Set ManipulationMode on an element in order to receive manipulation events -->
  <!-- This causes the scroll viewer to stop working! -->
  <Border ManipulationMode="All"
          ManipulationDelta="..."/>
  <Border/>
  <Border/>
</ScrollViewer>

I understand that to improve performance, WinRT ScrollVieweruses a special ManipulationModeof System, but I would like to have a vertical scroll list containing items that correspond to horizontal manipulations / gestures. Can anyone think of a creative workaround that will make this possible?

+5
source share
2 answers

, ScrollViewer . , ScrollViewer - ScrollViewer ScrollToHorizontal/VerticalOffset(). ManipulationStarted VisualTreeHelper.FindElementsInHostCoordinates, , , , , . . RenderTransform ScrollContentPresenter ScrollViewer, / , ScrollViewer, .. , , . , , , - .

EDIT * , , , , ScrollViewer ViewChanged .

2 *

Windows 8.1 ManipulationModes.System, ScrollViewer. CancelDirectManipulations() , , ScrollViewers .

+8

, . , .

public MovableGrid()
        {
            ManipulationMode = ManipulationModes.TranslateX | ManipulationModes.System;
            AddHandler(ManipulationDeltaEvent, new ManipulationDeltaEventHandler(UIElement_OnManipulationDelta), true);
            AddHandler(ManipulationCompletedEvent, new ManipulationCompletedEventHandler(UIElement_OnManipulationCompleted), true);
        }

, MovableGrid X, MovableGrids, scrollviewer. , .

+10

All Articles