Ejemplo n.º 1
0
        public Page CreateDefaultMainPage()
        {
            var layout = new StackLayout {
                BackgroundColor = Color.Red
            };

            layout.Children.Add(new Label {
                Text = "This is master Page"
            });
            var master = new ContentPage {
                Title = "Flyout", Content = layout, BackgroundColor = Color.SkyBlue, IconImageSource = "menuIcon"
            };

            master.On <iOS>().SetUseSafeArea(true);
            var mdp = new FlyoutPage
            {
                AutomationId = DefaultMainPageId,
                Flyout       = master,
                Detail       = CoreGallery.GetMainPage()
            };

            master.IconImageSource.AutomationId = "btnMDPAutomationID";
            mdp.SetAutomationPropertiesName("Main page");
            mdp.SetAutomationPropertiesHelpText("Main page help text");
            mdp.Flyout.IconImageSource.SetAutomationPropertiesHelpText("This as MDP icon");
            mdp.Flyout.IconImageSource.SetAutomationPropertiesName("MDPICON");
            return(mdp);
            //return new XamStore.StoreShell();
        }
Ejemplo n.º 2
0
        public MainPage()
        {
            InitializeComponent();

            Forms.Init();
            FormsMaps.Init();

            Content = CoreGallery.GetMainPage().ConvertPageToUIElement(this);

            MessagingCenter.Subscribe <RootPagesGallery, Type>(this, Messages.ChangeRoot, (sender, pagetype) =>
            {
                var page     = ((Page)Activator.CreateInstance(pagetype));
                app.MainPage = page;
            });

            MessagingCenter.Subscribe <HomeButton>(this, Messages.GoHome, (sender) => {
                var page     = FormsApp.GetFormsApp();
                app.MainPage = page;
            });
        }
Ejemplo n.º 3
0
        public SwapHierachyStackLayout(string heirarchy)
        {
            AutomationId = "ChoosePageScrollView";

            BackgroundColor = Color.Blue;

            var buttons = new [] {
                new SwapRootButton("Content", new Command(() => Application.Current.MainPage                 = new RootContentPage("Content"))),
                new SwapRootButton("Nav->Content", new Command(() => Application.Current.MainPage            = new RootNavigationContentPage("Nav->Content"))),
                new SwapRootButton("MDP->Nav->Content", new Command(() => Application.Current.MainPage       = new RootMDPNavigationContentPage("MDP->Nav->Content"))),
                new SwapRootButton("Tab->Content", new Command(() => Application.Current.MainPage            = new RootTabbedContentPage("Tab->Content"))),
                new SwapRootButton("Tab->MDP->Nav->Content", new Command(() => Application.Current.MainPage  = new RootTabbedMDPNavigationContentPage("Tab->MDP->Nav->Content"))),
                new SwapRootButton("Tab->Nav->Content", new Command(() => Application.Current.MainPage       = new RootTabbedNavigationContentPage("Tab->Nav->Content"))),
                new SwapRootButton("Tab(Many)->Nav->Content", new Command(() => Application.Current.MainPage = new RootTabbedManyNavigationContentPage("Tab(Many)->Nav->Content"))),
                // tsk tsk
                new SwapRootButton("Nav->Tab->Content(BAD IDEA)", new Command(() => Application.Current.MainPage       = new RootNavigationTabbedContentPage("Nav->Tab->Content(BAD IDEA)"))),
                new SwapRootButton("Nav->Tab(Many)->Content(BAD IDEA)", new Command(() => Application.Current.MainPage = new RootNavigationManyTabbedPage("Nav->Tab(Many)->Content(BAD IDEA)"))),
                new SwapRootButton("MDP->Nav->Tab->Content(BAD IDEA)", new Command(() => Application.Current.MainPage  = new RootMDPNavigationTabbedContentPage("MDP->Nav->Tab->Content(BAD IDEA)"))),
                // modals
                new SwapRootButton("(Modal)Content", new Command(async() => await Application.Current.MainPage.Navigation.PushModalAsync(new RootContentPage("(Modal)Content")))),
                new SwapRootButton("(Modal)Nav->Content", new Command(async() => await Application.Current.MainPage.Navigation.PushModalAsync(new RootNavigationContentPage("(Modal)Nav->Content")))),
                new SwapRootButton("(Modal)MDP->Nav->Content", new Command(async() => await Application.Current.MainPage.Navigation.PushModalAsync(new RootMDPNavigationContentPage("(Modal)MDP->Nav->Content")))),
                new SwapRootButton("(Modal)Tab->Content", new Command(async() => await Application.Current.MainPage.Navigation.PushModalAsync(new RootTabbedContentPage("(Modal)Tab->Content")))),
                new SwapRootButton("(Modal)Tab->MDP->Nav->Content", new Command(async() => await Application.Current.MainPage.Navigation.PushModalAsync(new RootTabbedMDPNavigationContentPage("(Modal)Tab->MDP->Nav->Content")))),
                new SwapRootButton("(Modal)Tab->Nav->Content", new Command(async() => await Application.Current.MainPage.Navigation.PushModalAsync(new RootTabbedNavigationContentPage("(Modal)Tab->Nav->Content")))),
                new SwapRootButton("(Modal)Tab(Many)->Nav->Content", new Command(async() => await Application.Current.MainPage.Navigation.PushModalAsync(new RootTabbedManyNavigationContentPage("(Modal)Tab(Many)->Nav->Content")))),
                // tsk tsk
                new SwapRootButton("(Modal)Nav->Tab->Content(BAD IDEA)", new Command(async() => await Application.Current.MainPage.Navigation.PushModalAsync(new RootNavigationTabbedContentPage("(Modal)Nav->Tab->Content(BAD IDEA)")))),
                new SwapRootButton("(Modal)Nav->Tab(Many)->Content(BAD IDEA)", new Command(async() => await Application.Current.MainPage.Navigation.PushModalAsync(new RootNavigationManyTabbedPage("(Modal)Nav->Tab(Many)->Content(BAD IDEA)")))),
                new SwapRootButton("(Modal)MDP->Nav->Tab->Content(BAD IDEA)", new Command(async() => await Application.Current.MainPage.Navigation.PushModalAsync(new RootMDPNavigationTabbedContentPage("(Modal)MDP->Nav->Tab->Content(BAD IDEA)")))),
                new SwapRootButton("(Modal)CoreGallery", new Command(() => Application.Current.MainPage = CoreGallery.GetMainPage()))
            };

            var layout = new StackLayout();

            layout.Children.Add(new Label {
                Text = heirarchy
            });

            foreach (var button in buttons)
            {
                layout.Children.Add(button);
            }

            Content = layout;
        }