c# - Swipe gesture doesn't work when there is a pivot in UWP -


im designing uwp , want add swipe gesture open hamburger menu. however, in 1 of pages add in pivot, , swipe gesture doesn't open menu, instead switches pivotitem.

how make them both alive in same page?

here code swipe gesture: (thx http://blog.csdn.net/github_36704374/article/details/59580697)

namespace humberger   {   public sealed partial class mainpage : page   {       private double x = 0;                       //用来接收手势水平滑动的长度          public mainpage()       {           this.initializecomponent();             this.manipulationmode = manipulationmodes.translatex;            //设置这个页面的手势模式为横向滑动           this.manipulationcompleted += the_manipulationcompleted;         //订阅手势滑动结束后的事件            this.manipulationdelta += the_manipulationdelta;                 //订阅手势滑动事件         }         //手势滑动中       private void the_manipulationdelta(object sender, manipulationdeltaroutedeventargs e)       {           x += e.delta.translation.x;     //将滑动的值赋给x        }         //手势滑动结束       private void the_manipulationcompleted(object sender, manipulationcompletedroutedeventargs e)       {           if (x > 100)                    //判断滑动的距离               mysplit.ispaneopen = true;    //打开汉堡菜单           if (x < -100)               mysplit.ispaneopen = false;   //关闭汉堡菜单           x = 0;  //清零x,不然x会累加       }         //汉堡菜单点击事件       private void humberger_click(object sender, routedeventargs e)       {           mysplit.ispaneopen = !mysplit.ispaneopen;       }   }   

}

yes, pivot or hub control swallow horizontal user inputs. if want able swipe edge bring out drawer of menu, here's trick -

give pivot left margin of 1px.

doing allow host element receive touch manipulations when swiping edge of device.

i did exact thing couple of years ago in video, pivot , radsidedrawer telerik. radsidedrawer control open sourced part of telerik ui uwp.

i rolled own swipeablesplitview control explained here.

hope helps!


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -