c# - Making swipe work for a pivot control with embedded WebBrowser on Windows Phone 8.0 -


i'd application have pivot control webbrowser control in each pivotitem. problem swiping next pivotitem doesn't work since instead results in scrolling web page horizontally. however, web pages responsive , doesn't need scrolled horizontally instead want horizontal swiping result in pivot switch. can accomplished? if can't use pivot control recommended way implement page switching webcontrols on pages? top menu la ios/android?

yes possible, needs little workaround since webbrowser handles event first , pivot doesn't know it. can use purpose touch , event framereported. simple code can this:

public mainpage() {    initializecomponent();    touch.framereported += touch_framereported; }  touchpoint first;  private void touch_framereported(object sender, touchframeeventargs e) {    touchpoint maintouch = e.getprimarytouchpoint(mywebbrowser);    if (maintouch.action == touchaction.down)          first = maintouch;    else if (maintouch.action == touchaction.up)    {        if (maintouch.position.x - first.position.x < 0)             messagebox.show("next item.");            //mypivot.selectedindex++;        if (maintouch.position.x - first.position.x > 0)            messagebox.show("previous item.");           //mypivot.selectedindex--;    } } 

as can see - i'm remembering user start movements, when releases touch - change mypivot.selectetindex. hope helps little. can try touchpanel, think simpler (if it's sufficient).


if want disable gestures can example in code below. enabled horizontaldrag - won't fire zoom. tolerance of course shouldn't 0, have define suitable app.

// in mainpage() constructor touchpanel.enabledgestures = gesturetype.horizontaldrag;   private void touch_framereported(object sender, touchframeeventargs e) {    touchpoint maintouch = e.getprimarytouchpoint(mymap);    if (maintouch.action == touchaction.down)         first = maintouch;    else if (maintouch.action == touchaction.up && touchpanel.isgestureavailable)    {       if (maintouch.position.x - first.position.x < 0)         messagebox.show("next item.");         //mypivot.selectedindex++;       if (maintouch.position.x - first.position.x > 0)         messagebox.show("previous item.");         //mypivot.selectedindex--;    } } 

Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -