Exemple #1
0
        protected override void Init()
        {
            var masterPage = new MasterPage();

            Flyout = masterPage;
            masterPage.ListView.ItemSelected += (sender, e) =>
            {
                var item = e.SelectedItem as MasterPageItem;
                if (item != null)
                {
                    Detail = new NavigationPageEx((Page)Activator.CreateInstance(item.TargetType));
                    masterPage.ListView.SelectedItem = null;
                    IsPresented = false;
                }
            };

            Detail    = new NavigationPageEx(new _409555_Page1());
            Reference = this;
        }
        public void ThorwsInSetIsPresentOnSplitPortraitModeOnTablet()
        {
            Device.Idiom = TargetIdiom.Tablet;
            Device.Info.CurrentOrientation = DeviceOrientation.Portrait;

            var page = new FlyoutPage
            {
                Flyout = new ContentPage {
                    Content = new View(), IsPlatformEnabled = true, Title = "Foo"
                },
                Detail = new ContentPage {
                    Content = new View(), IsPlatformEnabled = true
                },
                IsPlatformEnabled    = true,
                FlyoutLayoutBehavior = FlyoutLayoutBehavior.SplitOnPortrait
            };

            Assert.Throws <InvalidOperationException>(() => page.IsPresented = false);
        }
Exemple #3
0
        public void TestSetIsPresentedOnPopoverMode()
        {
            mockDeviceDisplay.SetMainDisplayOrientation(DisplayOrientation.Landscape);

            var page = new FlyoutPage
            {
                Flyout = new ContentPage {
                    Content = new View(), IsPlatformEnabled = true, Title = "Foo"
                },
                Detail = new ContentPage {
                    Content = new View(), IsPlatformEnabled = true
                },
                IsPlatformEnabled    = true,
                FlyoutLayoutBehavior = FlyoutLayoutBehavior.Popover
            };

            page.IsPresented = true;

            Assert.AreEqual(true, page.IsPresented);
        }
Exemple #4
0
        public void TabBarSetsOnFlyoutPage()
        {
            var contentPage1   = new ContentPage();
            var navigationPage = new TestNavigationPage(true, contentPage1);
            var flyoutPage     = new FlyoutPage()
            {
                Detail = navigationPage,
                Flyout = new ContentPage()
                {
                    Title = "Flyout"
                }
            };

            var window = new TestWindow(flyoutPage);

            Assert.IsNull(window.Toolbar);
            Assert.IsNull(contentPage1.Toolbar);
            Assert.IsNull(navigationPage.Toolbar);
            Assert.IsNotNull(flyoutPage.Toolbar);
        }
Exemple #5
0
        public void TestSetIsPresentedOnPopoverMode()
        {
            Device.Info.CurrentOrientation = DeviceOrientation.Landscape;

            var page = new FlyoutPage
            {
                Flyout = new ContentPage {
                    Content = new View(), IsPlatformEnabled = true, Title = "Foo"
                },
                Detail = new ContentPage {
                    Content = new View(), IsPlatformEnabled = true
                },
                IsPlatformEnabled    = true,
                FlyoutLayoutBehavior = FlyoutLayoutBehavior.Popover
            };

            page.IsPresented = true;

            Assert.AreEqual(true, page.IsPresented);
        }
Exemple #6
0
        public async Task FlyoutPageDetailChanged()
        {
            var firstPage = new LCPage()
            {
                Title = "First Page"
            };
            var secondPage = new LCPage()
            {
                Title = "Second Page"
            };
            var flyoutPage = new FlyoutPage()
            {
                Detail = firstPage
            };

            flyoutPage.Detail = secondPage;

            Assert.IsNotNull(firstPage.NavigatingFromArgs);
            Assert.AreEqual(firstPage, secondPage.NavigatedToArgs.PreviousPage);
            Assert.AreEqual(secondPage, firstPage.NavigatedFromArgs.DestinationPage);
        }
Exemple #7
0
        public void TestDetailChanged()
        {
            FlyoutPage page  = new FlyoutPage();
            var        child = new ContentPage {
                Content = new Label()
            };

            bool changed = false;

            page.PropertyChanged += (sender, e) =>
            {
                if (e.PropertyName == "Detail")
                {
                    changed = true;
                }
            };

            page.Detail = child;

            Assert.True(changed);
        }
Exemple #8
0
        public static FlyoutPage MacDemoFlyoutPage()
        {
            var mdp = new FlyoutPage();

            var master = new ContentPage {
                BackgroundColor = Colors.Red, Title = "Flyout", Content = new Label {
                    Text = "This is Flyout Page"
                }
            };

            var detail = new ContentPage {
                BackgroundColor = Colors.Blue, Title = "Detail", Content = new Label {
                    Text = "This is Detail Page"
                }
            };

            mdp.Flyout = master;
            mdp.Detail = detail;

            return(mdp);
        }
Exemple #9
0
        public void TestFlyoutVisible()
        {
            var page = new FlyoutPage();

            Assert.AreEqual(false, page.IsPresented);

            bool signaled = false;

            page.PropertyChanged += (sender, args) =>
            {
                if (args.PropertyName == FlyoutPage.IsPresentedProperty.PropertyName)
                {
                    signaled = true;
                }
            };

            page.IsPresented = true;

            Assert.AreEqual(true, page.IsPresented);
            Assert.True(signaled);
        }
Exemple #10
0
        public async Task TabBarSetsOnFlyoutPageInsideModalPage()
        {
            var window         = new TestWindow(new ContentPage());
            var contentPage1   = new ContentPage();
            var navigationPage = new TestNavigationPage(true, contentPage1);
            var flyoutPage     = new FlyoutPage()
            {
                Detail = navigationPage,
                Flyout = new ContentPage()
                {
                    Title = "Flyout"
                }
            };

            await window.Navigation.PushModalAsync(flyoutPage);

            Assert.IsNull(window.Toolbar);
            Assert.IsNull(contentPage1.Toolbar);
            Assert.IsNull(navigationPage.Toolbar);
            Assert.IsNotNull(flyoutPage.Toolbar);
        }
Exemple #11
0
        public void TestFlyoutChanged()
        {
            FlyoutPage page  = new FlyoutPage();
            var        child = new ContentPage {
                Content = new Label(), Title = "Foo"
            };

            bool changed = false;

            page.PropertyChanged += (sender, e) =>
            {
                if (e.PropertyName == "Flyout")
                {
                    changed = true;
                }
            };

            page.Flyout = child;

            Assert.True(changed);
        }
Exemple #12
0
        /// <summary>
        /// 设置订单页导航
        /// </summary>
        /// <param name="orderPage"></param>
        internal void InitialMasterDetail(FlyoutPage orderPage, NavigationPage productNavigation, NavigationPage selectedNavigation)
        {
            if (!_isInitialMasterDetailAlready || this.orderNavigation != orderPage)
            {
                this.orderNavigation = orderPage;

                this.productNavigation  = productNavigation;
                this.selectedNavigation = selectedNavigation;

                NavigationMasterDetailList.Clear();

                NavigationMasterDetailList.Add(productNavigation, new List <Page>());
                NavigationMasterDetailList.Add(selectedNavigation, new List <Page>());

                _currentMasterDetailNavigate = null;

                _isInitialMasterDetailAlready = true;
            }

            App.Current.MainPage = this.orderNavigation;
            NavigationMode       = 2;
        }
Exemple #13
0
        void InitializeMainPage()
        {
            Routing.RegisterRoute(nameof(SandboxNavigationPage), typeof(SandboxNavigationPage));
            Routing.RegisterRoute(nameof(ModalNavigationPage), typeof(ModalNavigationPage));
            Routing.RegisterRoute(nameof(MainPage), typeof(MainPage));

            bool useTabPage        = false;
            bool useMDP            = false;
            bool useFlyoutPage     = false;
            bool useMainPage       = false;
            bool useNavigationPage = false;

            if (useNavigationPage)
            {
                MainPage = new NavigationPage(new MainPage());
            }
            else if (useMainPage)
            {
                MainPage = new MainPage();
            }
            else if (useFlyoutPage)
            {
                MainPage = new FlyoutPage();
            }
            else if (useMDP)
#pragma warning disable CS0612 // Type or member is obsolete
            {
                MainPage = new MDP();
            }
#pragma warning restore CS0612 // Type or member is obsolete
            else if (useTabPage)
            {
                MainPage = new TabPage();
            }
            else
            {
                MainPage = new ShellPage();
            }
        }
        internal static MauiAppBuilder RemapForControls(this MauiAppBuilder builder)
        {
            // Update the mappings for IView/View to work specifically for Controls
            Application.RemapForControls();
            VisualElement.RemapForControls();
            Label.RemapForControls();
            Button.RemapForControls();
            RadioButton.RemapForControls();
            FlyoutPage.RemapForControls();
            Toolbar.RemapForControls();
            Window.RemapForControls();
            Editor.RemapForControls();
            Entry.RemapForControls();
            SearchBar.RemapForControls();
            TabbedPage.RemapForControls();
            Layout.RemapForControls();
            RefreshView.RemapForControls();
            Shape.RemapForControls();
            WebView.RemapForControls();

            return(builder);
        }
Exemple #15
0
        public async Task FlyoutPageWithToolbar()
        {
            SetupBuilder();
            var flyoutPage = new FlyoutPage()
            {
                Detail = new NavigationPage(new ContentPage()
                {
                    Title = "Detail"
                }),
                Flyout = new ContentPage()
                {
                    Title = "Flyout"
                }
            };

            await CreateHandlerAndAddToWindow <FlyoutViewHandler>(flyoutPage, (handler) =>
            {
                // validate that nothing crashes

                return(Task.CompletedTask);
            });
        }
Exemple #16
0
            public MasterPage(FlyoutPage masterPage)
            {
                _masterPage = masterPage;
                Title       = "Menu";

                for (int i = 0; i < 5; i++)
                {
                    if (i == 0)
                    {
                        _items = new List <string>();
                    }

                    _items.Add("Menu Items");
                }

                var list = new ListView {
                    ItemsSource = _items, RowHeight = 100, HasUnevenRows = true
                };

                list.ItemSelected += list_ItemSelected;

                Content = list;
            }
Exemple #17
0
        public async Task DetailsViewUpdates()
        {
            SetupBuilder();
            var flyoutPage = new FlyoutPage()
            {
                Detail = new ContentPage()
                {
                    Title = "Detail"
                },
                Flyout = new ContentPage()
                {
                    Title = "Flyout"
                }
            };

            await CreateHandlerAndAddToWindow <FlyoutViewHandler>(flyoutPage, async (handler) =>
            {
                var details2 = new ContentPage()
                {
                    Title = "Detail"
                };
                var flyoutView = flyoutPage.ToPlatform();
                var detailView = flyoutPage.Detail.ToPlatform();
                var dl         = FindPlatformFlyoutView(detailView);
                Assert.Equal(flyoutView, dl);

                flyoutPage.Detail = details2;
                var detailView2   = details2.ToPlatform();

                await detailView2.OnLoadedAsync();
                await detailView.OnUnloadedAsync();
                dl = FindPlatformFlyoutView(detailView2);
                Assert.Equal(flyoutView, dl);
                Assert.Null(FindPlatformFlyoutView(detailView));
            });
        }
Exemple #18
0
        public void SendsBackEventToPresentedFlyoutFirst()
        {
            var detail = new BackButtonPage()
            {
                Handle = true
            };
            var Flyout = new BackButtonPage()
            {
                Title = "Flyout"
            };
            var mdp = new FlyoutPage()
            {
                Detail            = detail,
                Flyout            = Flyout,
                IsPresented       = true,
                IsPlatformEnabled = true,
            };

            ((IFlyoutPageController)mdp).BackButtonPressed += (sender, args) =>
            {
                args.Handled    = mdp.IsPresented;
                mdp.IsPresented = false;
            };

            var detailEmitted = false;
            var FlyoutEmitted = false;

            detail.BackPressed += (sender, args) => detailEmitted = true;
            Flyout.BackPressed += (sender, args) => FlyoutEmitted = true;

            var result = mdp.SendBackButtonPressed();

            Assert.True(FlyoutEmitted);
            Assert.False(detailEmitted);
            Assert.True(result);
        }
Exemple #19
0
        public void FlyoutPageAppearingAndDisappearingPropagatesToDetail()
        {
            int disappearing = 0;
            int appearing    = 0;

            var detail = new ContentPage()
            {
                Title = "detail"
            };
            var flyoutPage = new FlyoutPage()
            {
                Flyout = new ContentPage()
                {
                    Title = "flyout"
                },
                Detail = detail
            };

            _ = new TestWindow(flyoutPage);

            detail.Appearing    += (_, __) => appearing++;
            detail.Disappearing += (_, __) => disappearing++;

            Assert.AreEqual(0, disappearing);
            Assert.AreEqual(0, appearing);

            flyoutPage.SendDisappearing();

            Assert.AreEqual(1, disappearing);
            Assert.AreEqual(0, appearing);

            flyoutPage.SendAppearing();

            Assert.AreEqual(1, disappearing);
            Assert.AreEqual(1, appearing);
        }
Exemple #20
0
        public void TestLayoutChildren()
        {
            var page = new FlyoutPage
            {
                Flyout = new ContentPage {
                    Content = new View(), IsPlatformEnabled = true, Title = "Foo"
                },
                Detail = new ContentPage {
                    Content = new View(), IsPlatformEnabled = true
                },
                IsPlatformEnabled = true,
            };

            ((IFlyoutPageController)page).FlyoutBounds = new Rectangle(0, 0, 100, 200);
            ((IFlyoutPageController)page).DetailBounds = new Rectangle(0, 0, 100, 100);

            page.Flyout.Layout(new Rectangle(0, 0, 1, 1));
            page.Detail.Layout(new Rectangle(0, 0, 1, 1));

            page.Layout(new Rectangle(0, 0, 200, 200));

            Assert.AreEqual(new Rectangle(0, 0, 100, 200), page.Flyout.Bounds);
            Assert.AreEqual(new Rectangle(0, 0, 100, 100), page.Detail.Bounds);
        }
Exemple #21
0
        protected override void Init()
        {
            BarBackgroundColor = Color.Red;

            var contentPage2 = new ContentPage();

            contentPage2.Title           = Page2;
            contentPage2.BackgroundColor = Color.Green;

            contentPage2.Appearing    += ContentPage2_Appearing;
            contentPage2.Disappearing += ContentPage2_Disappearing;

            var tabbedPage1 = new TabbedPage();

            tabbedPage1.Appearing    += TabbedPage1_Appearing;
            tabbedPage1.Disappearing += TabbedPage1_Disappearing;

            var contentPage3 = new ContentPage()
            {
                Title = Page3
            };

            contentPage3.BackgroundColor = Color.Pink;
            tabbedPage1.Children.Add(contentPage3);

            var FlyoutPage1 = new FlyoutPage();

            FlyoutPage1.Title = Page3;
            var master1 = new ContentPage();

            master1.BackgroundColor = Color.Yellow;
            master1.Title           = "Flyout 1";
            var detail1 = new ContentPage();

            detail1.Title                    = "Detail 1";
            detail1.BackgroundColor          = Color.Purple;
            FlyoutPage1.Flyout               = master1;
            FlyoutPage1.Detail               = detail1;
            FlyoutPage1.BackgroundColor      = Color.Yellow;
            FlyoutPage1.Detail.Appearing    += FlyoutPage1_Appearing;
            FlyoutPage1.Detail.Disappearing += FlyoutPage1_Disappearing;

            var contentPage1 = new ContentPage();

            SetHasBackButton(contentPage1, true);
            contentPage1.BackgroundColor = Color.Blue;
            contentPage1.Title           = Page1;
            var stack = new StackLayout();

            contentPage1.Content = stack;

            stack.Children.Add(new Button()
            {
                Text = Content, Command = new Command(() => PushAsync(contentPage2))
            });
            stack.Children.Add(new Button()
            {
                Text = FlyoutPage, Command = new Command(() => PushAsync(FlyoutPage1))
            });
            stack.Children.Add(new Button()
            {
                Text = TabbedPage2, Command = new Command(() => PushAsync(tabbedPage1))
            });
            stack.Children.Add(new Label()
            {
                Text      = "Navigate to each page 2 times, and make sure the Display Alert shows up all the times.",
                TextColor = Color.White,
                HorizontalTextAlignment = TextAlignment.Center
            });

            PushAsync(contentPage1);
        }
Exemple #22
0
        void RegisterToolbar()
        {
            Context  context = Context;
            AToolbar bar     = _toolbar;
            Element  page    = Element.RealParent;

            _flyoutPage = null;
            while (page != null)
            {
                if (page is FlyoutPage)
                {
                    _flyoutPage = page as FlyoutPage;
                    break;
                }
                page = page.RealParent;
            }

            if (_flyoutPage == null)
            {
                if (PageController.InternalChildren.Count > 0)
                {
                    _flyoutPage = PageController.InternalChildren[0] as FlyoutPage;
                }

                if (_flyoutPage == null)
                {
                    return;
                }
            }

            if (((IFlyoutPageController)_flyoutPage).ShouldShowSplitMode)
            {
                return;
            }

            var renderer = APlatform.GetRenderer(_flyoutPage) as FlyoutPageRenderer;

            if (renderer == null)
            {
                return;
            }

            _drawerLayout = renderer;

            Controls.Platform.AutomationPropertiesProvider.GetDrawerAccessibilityResources(context, _flyoutPage, out int resourceIdOpen, out int resourceIdClose);

            if (_drawerToggle != null)
            {
                _drawerToggle.ToolbarNavigationClickListener = null;
                _drawerToggle.Dispose();
            }

            _drawerToggle = new ActionBarDrawerToggle(context.GetActivity(), _drawerLayout, bar,
                                                      resourceIdOpen == 0 ? global::Android.Resource.String.Ok : resourceIdOpen,
                                                      resourceIdClose == 0 ? global::Android.Resource.String.Ok : resourceIdClose)
            {
                ToolbarNavigationClickListener = new ClickListener(Element)
            };

            if (_drawerListener != null)
            {
                _drawerLayout.RemoveDrawerListener(_drawerListener);
                _drawerListener.Dispose();
            }

            _drawerListener = new DrawerMultiplexedListener {
                Listeners = { _drawerToggle, renderer }
            };
            _drawerLayout.AddDrawerListener(_drawerListener);
        }
        public NavBarTitleTestPage()
        {
            var navTab = new NavigationPage {
                Title = "Hello 1 nav"
            };

            navTab.PushAsync(GetPage(navTab));

            var stackPages = new StackLayout();

            var btn3 = new Button
            {
                Text    = "tab",
                Command = new Command(async() =>
                {
                    var tabbed = new TabbedPage {
                        Title = "Main Tab"
                    };
                    tabbed.Children.Add(navTab);
                    tabbed.Children.Add(GetPage(navTab));
                    await Navigation.PushModalAsync(tabbed);
                })
            };

            var btn4 = new Button
            {
                Text    = "mdp",
                Command = new Command(async() =>
                {
                    var newNav = new NavigationPage {
                        Title = "Hello 1 nav", BarBackgroundColor = Colors.Pink, BarTextColor = Colors.Blue
                    };
                    var mdp = new FlyoutPage();
                    await newNav.PushAsync(GetPage(newNav));
                    mdp.Flyout = new ContentPage
                    {
                        Title           = "Flyout",
                        BackgroundColor = Colors.Red,
                        Content         = new Button
                        {
                            Text    = "new",
                            Command = new Command(() =>
                            {
                                mdp.Detail = new ContactsPage {
                                    Title = "hello 3"
                                };
                                mdp.IsPresented = false;
                            })
                        }
                    };
                    mdp.Detail = newNav;
                    await Navigation.PushModalAsync(mdp);
                })
            };

            var btn5 = new Button
            {
                Text    = "nav",
                Command = new Command(async() =>
                {
                    var newNav = new NavigationPage {
                        Title = "Hello 1 nav"
                    };
                    await newNav.PushAsync(GetPage(newNav));
                    await Navigation.PushModalAsync(newNav);
                })
            };

            var btn6 = new Button
            {
                Text    = "change nav",
                Command = new Command(() =>
                {
                    (Parent as NavigationPage).BarBackgroundColor = Colors.Blue;
                    (Parent as NavigationPage).BarTextColor       = Colors.Pink;
                })
            };

            stackPages.Children.Add(btn3);
            stackPages.Children.Add(btn4);
            stackPages.Children.Add(btn5);
            stackPages.Children.Add(btn6);
            Content = stackPages;
        }
Exemple #24
0
        protected override void Init()
        {
            var rootContentPageLayout = new StackLayout();
            var rootContentPageButton = new Button()
            {
                Text            = "PushAsync to next page",
                AutomationId    = "btnNext",
                BackgroundColor = Color.FromHex("#ecf0f1"),
                TextColor       = Colors.Black
            };

            rootContentPageButton.Clicked += async(sender, args) =>
            {
                await Navigation.PushAsync(FirstContentPage);
            };

            rootContentPageLayout.Children.Add(rootContentPageButton);
            Content = rootContentPageLayout;

            Title           = "RootPage";
            BackgroundColor = Color.FromHex("#2c3e50");

            //MASTER PAGE
            MasterPage = new ContentPage()
            {
                Title           = "Flyout",
                BackgroundColor = Color.FromHex("#1abc9c")
            };
            var masterPageLayout = new StackLayout();
            var masterPageButton = new Button()
            {
                Text            = "Pop Modal and Pop Root",
                AutomationId    = "btnPop",
                BackgroundColor = Color.FromHex("#ecf0f1"),
                TextColor       = Colors.Black
            };

            masterPageButton.Clicked += async(sender, args) =>
            {
                await Navigation.PopModalAsync();

                await Navigation.PopToRootAsync();
            };
            masterPageLayout.Children.Add(masterPageButton);
            MasterPage.Content = masterPageLayout;


            //DETAIL PAGE
            DetailPage = new NavigationPage(new ContentPage()
            {
                Title           = "RootNavigationDetailPage",
                BackgroundColor = Color.FromHex("#2980b9"),
                Content         = new Button
                {
                    Text      = "PopModal",
                    TextColor = Colors.White,
                    Command   = new Command(async() =>
                    {
                        await Navigation.PopModalAsync();
                    })
                }
            });

            //MASTERDETAIL PAGE
            HomePage = new FlyoutPage()
            {
                Flyout = MasterPage,
                Detail = DetailPage
            };

            //FIRST CONTENT PAGE
            FirstContentPage = new ContentPage()
            {
                Title           = "First Content Page",
                BackgroundColor = Color.FromHex("#e74c3c")
            };
            var firstContentPageLayout = new StackLayout();
            var firstContentPageButton = new Button()
            {
                Text            = "Push Modal To Flyout-Detail Page",
                AutomationId    = "btnPushModal",
                BackgroundColor = Color.FromHex("#ecf0f1"),
                TextColor       = Colors.Black
            };

            firstContentPageButton.Clicked += async(sender, args) =>
            {
                await Navigation.PushModalAsync(HomePage);
            };
            firstContentPageLayout.Children.Add(firstContentPageButton);
            FirstContentPage.Content = firstContentPageLayout;
        }
Exemple #25
0
        void IVisualElementRenderer.SetElement(VisualElement element)
        {
            FlyoutPage oldElement = Element;
            FlyoutPage newElement = Element = element as FlyoutPage;

            if (oldElement != null)
            {
                DeviceDisplay.MainDisplayInfoChanged -= DeviceInfoPropertyChanged;

                ((IFlyoutPageController)oldElement).BackButtonPressed -= OnBackButtonPressed;

                oldElement.PropertyChanged -= HandlePropertyChanged;
                oldElement.Appearing       -= FlyoutPageAppearing;
                oldElement.Disappearing    -= FlyoutPageDisappearing;

                RemoveDrawerListener(this);

                if (_detailLayout != null)
                {
                    RemoveView(_detailLayout);
                }

                if (_flyoutLayout != null)
                {
                    RemoveView(_flyoutLayout);
                }
            }

            if (newElement != null)
            {
                if (_detailLayout == null)
                {
                    _detailLayout = new FlyoutPageContainer(newElement, false, Context)
                    {
                        LayoutParameters = new LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent)
                    };

                    _flyoutLayout = new FlyoutPageContainer(newElement, true, Context)
                    {
                        LayoutParameters = new LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent)
                        {
                            Gravity = (int)GravityFlags.Start
                        }
                    };

                    if (_fragmentManager != null)
                    {
                        _detailLayout.SetFragmentManager(_fragmentManager);
                        _flyoutLayout.SetFragmentManager(_fragmentManager);
                    }

                    AddView(_detailLayout);
                    AddView(_flyoutLayout);

                    DeviceDisplay.MainDisplayInfoChanged += DeviceInfoPropertyChanged;

                    AddDrawerListener(this);
                }

                UpdateBackgroundColor(newElement);
                UpdateBackgroundImage(newElement);

                UpdateFlyout();
                UpdateDetail();

                UpdateFlowDirection();

                ((IFlyoutPageController)newElement).BackButtonPressed += OnBackButtonPressed;
                newElement.PropertyChanged += HandlePropertyChanged;
                newElement.Appearing       += FlyoutPageAppearing;
                newElement.Disappearing    += FlyoutPageDisappearing;

                SetGestureState();

                Presented = newElement.IsPresented;

                newElement.SendViewInitialized(this);
            }

            OnElementChanged(oldElement, newElement);

            // Make sure to initialize this AFTER event is fired
            if (_tracker == null)
            {
                _tracker = new VisualElementTracker(this);
            }

            if (element != null && !string.IsNullOrEmpty(element.AutomationId))
            {
                SetAutomationId(element.AutomationId);
            }

            SetContentDescription();
        }
Exemple #26
0
        protected override void Init()
        {
            s_mdp = this;

            var lblCount = new Label {
                AutomationId = "lblCount"
            };

            var myCarouselPage = new CarouselPage()
            {
                Children =
                {
                    new ContentPage        {
                        BackgroundColor = Color.Green,
                        Content         = new StackLayout {
                            Children =
                            {
                                new Button {
                                    AutomationId = "ShowMasterBtnPage1",
                                    Text         = "ShowMaster",
                                    Command      = new Command(() => s_mdp.IsPresented = true)
                                },
                                lblCount
                            }
                        }
                    },
                    new ContentPage        {
                        BackgroundColor = Color.Red
                    },
                    new ContentPage        {
                        BackgroundColor = Color.Lime,
                    },
                    new ContentPage        {
                        BackgroundColor = Color.Purple,
                    },
                }
            };

            var myCarouselDetailPage = new NavigationPage(myCarouselPage);

            var myPushButton = new Button()
            {
                Text = "Push Page",
                HorizontalOptions = LayoutOptions.Start
            };

            myCarouselPage.Appearing += (sender, e) =>
            {
                _countAppearing++;
                lblCount.Text = _countAppearing.ToString();
            };
            myCarouselPage.Disappearing += (sender, e) =>
            {
                _countAppearing--;
            };


            var mySecondDetailPage = new NavigationPage(new ContentPage()
            {
                Title = "My Second Page",

                Content = new StackLayout()
                {
                    Orientation = StackOrientation.Vertical,
                    Children    =
                    {
                        new Button {
                            AutomationId = "ShowMasterBtnPage2",
                            Text         = "ShowMaster",
                            Command      = new Command(() => s_mdp.IsPresented = true)
                        },
                        myPushButton
                    }
                }
            });

            myPushButton.Command = new Command(() => mySecondDetailPage.Navigation.PushAsync(new ContentPage()
            {
                Title = "My Pushed Page"
            }));

            var myMasterPage = new ContentPage()
            {
                Padding = new Thickness(0, 60, 0, 0),
                Title   = "Menu",
                Content = new StackLayout()
                {
                    Orientation = StackOrientation.Vertical,
                    Children    =
                    {
                        new Button()
                        {
                            Text         = "Detail 1",
                            AutomationId = "btnDetail1",
                            Command      = new Command(() => {
                                Detail      = myCarouselDetailPage;
                                IsPresented = false;
                            }),
                            HorizontalOptions = LayoutOptions.Start
                        },

                        new Button()
                        {
                            Text         = "Detail 2",
                            AutomationId = "btnDetail2",
                            Command      = new Command(() => {
                                Detail      = mySecondDetailPage;
                                IsPresented = false;
                            }),
                            HorizontalOptions = LayoutOptions.Start
                        }
                    }
                }
            };

            Flyout = myMasterPage;
            Detail = myCarouselDetailPage;
        }
        internal static void GetDrawerAccessibilityResources(global::Android.Content.Context context, FlyoutPage page, out int resourceIdOpen, out int resourceIdClose)
        {
            resourceIdOpen  = 0;
            resourceIdClose = 0;
            if (page == null)
            {
                return;
            }

            var automationIdParent = s_defaultDrawerId;
            var icon = page.Flyout?.IconImageSource;

            if (icon != null && !icon.IsEmpty)
            {
                automationIdParent = page.Flyout.IconImageSource.AutomationId;
            }
            else if (!string.IsNullOrEmpty(page.AutomationId))
            {
                automationIdParent = page.AutomationId;
            }

            resourceIdOpen  = context.Resources.GetIdentifier($"{automationIdParent}{s_defaultDrawerIdOpenSuffix}", "string", context.ApplicationInfo.PackageName);
            resourceIdClose = context.Resources.GetIdentifier($"{automationIdParent}{s_defaultDrawerIdCloseSuffix}", "string", context.ApplicationInfo.PackageName);
        }
Exemple #28
0
 protected override void OnAppearing()
 {
     base.OnAppearing();
     FlyoutPage.checkUserDetails();
 }
Exemple #29
0
 public void refresh()
 {
     FlyoutPage.checkUserDetails();
 }
Exemple #30
0
 public FlyoutPageContainer(FlyoutPage parent, bool isFlyout, Context context) : base(context)
 {
     Id        = APlatform.GenerateViewId();
     _parent   = parent;
     _isFlyout = isFlyout;
 }