How to implement swipe gesture with multiple PDF files

Hello,

I’m developing for Universal App with XAML and C#, and using PDFNet v6.3.2

I have about 100 PDF files, each file have only 1 page. I build a CustomControl, contain in it the border. The C# code behind is read the PDF file and load it to PDFDoc, then set it as child of border, just as sample. Everything work fine. The memory is around 60 MB at all time. I add 2 button for navigation, “Next page” and “Previous Page”

Now I have a problem. I’m unable to implement touch gesture (swipe, using finger and mouse). All the manipulation event I need is not fired (Except “ManipulationStarting”, which is not helpful).

I tried to assign manipulation events to parent control (border, event the grid), no luck.

Thanks

Hi,

This depends a bit on what you are doing. The “problem” with Windows is that once a build in control (e.g. ScrollViewer, FlipView, both of which are part of the PDFViewCtrl) takes command of manipulation input, then those events are all funneled to a background thread in that control that takes care of all future manipulation events, up to and including ManipulationCompleted. This is why you don’t get any events after ManipulationStarting.

I can suggest two ways to get around this problem:
One is to change the ManipualtionMode of the control or one of it’s children to Something other than System (this is what we do when you call PDFViewCtrl.SetScrollEnabled(false)). The problem here is that you need to decide this basically as soon as your finger touches down. So, for example, in the AnnotEdit tool, we check if the touch down is hitting a control point. If it does, we disable Scrolling and Zooming in the PDFViewCtrl. If you want to use this with the PDFViewCtrl, you might have to create pre-designated swipe areas or something.

The other thing you can try, is to always use PagePresentationMode continuous for the PDFViewCtrl’s, and then stick each and every PDFViewCtrl in a FlipView. This will let the system take care of scrolling and flipping. Basically, you will end up with a FlipView full of ScrollViewer (this is how we do SinglePage mode) and it should work fairly well.

Best Regards,
Tomas Hofmann