0

In my Android app made with Xamarin.Android I have a chart that uses OxyPlot.Android. The chart is a PlotView and is inside a NestedScrollView. The chart has pan and zoom enabled, but when I try to pan or zoom, the NestedScrollView also scrolls.

How do I prevent the NestedScrollView from scrolling while I touch the PlotView?

Nesh
  • 147
  • 1
  • 7
  • you'd need to 'handle' the scroll event in the nested scroll view. – JoeTomks Jul 17 '19 at 14:31
  • @Digitalsa1nt So I'd need to make a custom `NestedScrollView` that doesn't scroll when the view that was touched is a `PlotView`? Could you help me with where to start? What methods I need to override or how I figure out what view was touched? – Nesh Jul 18 '19 at 06:21

1 Answers1

0

I added these event handlers to the plotview's model

plotView.Model.TouchStarted += (sender, e) =>
{
    if (plotView.Parent != null)
        plotView.Parent.RequestDisallowInterceptTouchEvent(true);
};

plotView.Model.TouchCompleted += (sender, e) =>
{
    if (plotView.Parent != null)
        plotView.Parent.RequestDisallowInterceptTouchEvent(false);
};
Nesh
  • 147
  • 1
  • 7