Looking for some help when using Touch.FrameReported. I wanted to add drag scroll to my scroll viewers and have tried a variety of different things, none of which worked very well. I have figured out a solution and have the functionality that I want, but I have run into a snag when pinching or stretching to zoom in or out of the map. If pinch or stretch is used the map zooms in or out as expected however it won't refresh itself until you touch the map again with one finger. Then the map pans (jumps) to where you touched and refreshes like its supposed to. Panning with one figure works fine, the map refreshes without issue and performs as expected. It just happens when trying to zoom. I am sure that it has to do with the fact that it is a multipoint gesture, but I can't figure out how to filter that out in the Touch.FrameReported event. My code is below. public MainPage()
{
InitializeComponent();
Touch.FrameReported += new TouchFrameEventHandler(Touch_FrameReported);
}
MPScroll is the scrollviewer that I am applying the drag scroll to.void Touch_FrameReported(object sender, TouchFrameEventArgs e)
{
TouchPoint touchPoint = e.GetPrimaryTouchPoint(this.MPScroll);
Point touchedPosition = touchPoint.Position;
if (touchedPosition.X > 0 && touchedPosition.Y > 0 && touchedPosition.X < this.MPScroll.ActualWidth && touchedPosition.Y < this.MPScroll.ActualHeight)
{
if (touchPoint.Action == TouchAction.Down)
{
this.startX = touchedPosition.X;
this.currentScrollX = this.MPScroll.HorizontalOffset;
}
else if (touchPoint.Action == TouchAction.Move)
{
double xMoved = touchedPosition.X - this.startX;
this.MPScroll.ScrollToHorizontalOffset(this.currentScrollX - xMoved);
}
}
}
I am completely stumped on this one, any help is appreciated.~Bob