示例#1
0
        protected override void OnSizeAllocated(double width, double height)
        {
            base.OnSizeAllocated(width, height);

            NavPage1.WidthRequest = width;
            NavPage2.WidthRequest = width;

            NavPage1.HeightRequest = height;
            NavPage2.HeightRequest = height;

            var rc = NavPage2.Bounds;

            rc.X = width;
            NavPage2.LayoutTo(rc);

            rc.X = width * 2;
            NavPage3.LayoutTo(rc);
        }
示例#2
0
        public TabEX()
        {
            InitializeComponent();

            ContentViews = new Dictionary <int, View>();

            var children = Pages.Children;

            for (var i = 0; i < children.Count; i++)
            {
                ContentViews.Add(i + 1, children.ElementAt(i));
            }

            NavPage1.PreviousButton.Clicked += async(s, e) =>
            {
                var rc = new Rectangle(0, Height * 0.3, Width * 0.4, Height * 0.4);
                NavPage1.LayoutTo(rc);

                rc.X = Width * 0.6;
                await NavPage2.LayoutTo(rc);

                rc = new Rectangle(-Width, 0, Width, Height);
                NavPage1.LayoutTo(rc);

                rc.X = 0;
                await NavPage2.LayoutTo(rc);
            };

            NavPage1.BehindButton.Clicked += async(s, e) =>
            {
                /*
                 * var rc = new Rectangle(0, Height * 0.3, Width * 0.4, Height * 0.4);
                 * NavPage1.LayoutTo(rc);
                 */

                MovingView(NavPage1, 250, 0, Height * 0.3, Width * 0.4, Height * 0.4);

                /*
                 * rc.X = Width * 0.6;
                 * await NavPage2.LayoutTo(rc);
                 */

                await AsyncMovingView(NavPage2, 250, Width * 0.6, Height * 0.3, Width * 0.4, Height * 0.4);

                /*
                 * rc = new Rectangle(-Width, 0, Width, Height);
                 * NavPage1.LayoutTo(rc);
                 */

                MovingView(NavPage1, 250, -Width, 0, Width, Height);

                /*
                 * rc.X = 0;
                 * await NavPage2.LayoutTo(rc);
                 */

                await AsyncMovingView(NavPage2, 250, 0, 0, Width, Height);
            };

            NavPage2.PreviousButton.Clicked += async(s, e) =>
            {
                var rc = new Rectangle(Width * 0.6, Height * 0.3, Width * 0.4, Height * 0.4);
                NavPage2.LayoutTo(rc);

                rc.X = 0;
                await NavPage1.LayoutTo(rc);

                rc = new Rectangle(Width, 0, Width, Height);
                NavPage2.LayoutTo(rc);

                rc.X = 0;
                await NavPage1.LayoutTo(rc);
            };

            NavPage2.BehindButton.Clicked += async(s, e) =>
            {
                var rc = new Rectangle(Width * 0.6, Height * 0.3, Width * 0.4, Height * 0.4);
                NavPage2.LayoutTo(rc);

                rc.X = 0;
                await NavPage3.LayoutTo(rc);

                rc = new Rectangle(0, 0, Width, Height);
                NavPage2.LayoutTo(rc);

                rc.X = -Width;
                await NavPage3.LayoutTo(rc);
            };
        }