c# - Process PointerWheelChanged event with GestureRecognizer -


i have uwp app, want handle manipulationdelta or manipulationupdated , manipulationcompleted on pointerwheelchanged event(to handle horizontal scroll mouse or touchpad).

on pointerwheelchanged event, have managed with

gesture.processmousewheelevent(e.getcurrentpoint(this), false,false); 

where e pointerroutedeventargs.

code snippet:

gesturerecognizer gesture = new gesturerecognizer(); gesture.manipulationcompleted += onmanipulationcompleted; gesture.manipulationupdated += onmanipulationupdated;   void onmanipulationupdated(object sender, manipulationupdatedeventargs e) {  //ideally should called whenever there change in manipulation }  void onmanipulationcompleted(object sender, manipulationcompletedeventargs e)     {     //code scroll //ideally has called on completion of manipulation event(correct me if wrong)     }    private void onpointerwheelchanged(object sender, pointerroutedeventargs e) {  gesture.processmousewheelevent(e.getintermediatepoints((this) sender)[0], false, false); } 

the problem approach is, whenever onpointerwheelchanged event fired , manipulationcompleted fired, despite myself performing single long slide in touchpad(finger in contact touch pad whole through slide).

ideally 1 manipulationcompleted event should triggered @ end of single long slide. multiple manipulationcompleted events getting triggered.

is there way out of this? making gesturerecognizer fire manipulationcompleted event @ end of slide?

whenever onpointerwheelchanged event fired , manipulationcompleted fired

it expected behavior. according pointerwheelchanged event:

if element pointer events occur has non-default manipulationmode value, action might result in various manipulation events manipulationstarted.

the reason of behaviour explained here:

the mouse wheel button has discrete, evenly spaced notches or distance thresholds (also called detents). when rotate or tilt wheel, wheel message sent each detent encountered.

so, if want handle when user finished rotating mouse wheel. suggest following 1 of options below:

  1. if want show data of event(e.g. position of grid). update each time manipulationcompleted event triggered. thus, user see real-time data.

  2. you can set state boundary point(e.g. bool gridhitboundary=false). in onmanipulationupdated update state when boundary point has been hit, , run logic in manipulationcompleted when gridhitboundary==true.


Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -