Пример #1
0
        public virtual TabbedPage TabbedPage(string title, params Xamarin.Forms.Page[] pages)
        {
            var page = new TopTabbedPage {
                Title = title,
                BarTextColor = Theme.Colors.Accent.Background,
                BarIndicatorColor = Theme.Colors.Accent.Background,
                BarBackgroundColor = Theme.Colors.Accent.Background,
            };

            pages.ForEach(p => page.Children.Add(p));

            return page.WithSafeAreas();
        }
Пример #2
0
        public App()
        {
            InitializeComponent();

            var tabs = new TopTabbedPage
            {
                Title = "TopTabs",
                BarBackgroundColor = Color.FromHex("9C27B0"),
                BarTextColor       = Color.Black
                                     // SwipeEnabled = false,
                                     //BarIndicatorColor = Color.DeepPink,
                                     //BarTextColor = Color.DeepPink
            };

            tabs.CurrentPageChanged += Tabs_CurrentPageChanged;
            tabs.Children.Add(new Page1
            {
                Title = "My Page",

                BackgroundColor = Color.Aquamarine
            });
            tabs.Children.Add(new Page2
            {
                Title           = "Tab 1",
                BackgroundColor = Color.Aqua
            });

            var m = new NavigationPage(tabs)
            {
                BarBackgroundColor = Color.FromHex("9C27B0"),
                BarTextColor       = Color.White
            };

            m.PropertyChanged += (sender, e) =>
            {
                System.Diagnostics.Debug.WriteLine(e.PropertyName);
            };

            MainPage = m;
        }
Пример #3
0
        private async void DidClickOnNavigateButton(object sender, EventArgs e)
        {
            var tabs = new TopTabbedPage
            {
                Title = "Second Top Tabs",
                BarBackgroundColor = Color.FromHex("9C27B0"),
                //BarIndicatorColor = Color.DeepPink,
                //BarTextColor = Color.DeepPink
            };

            tabs.Children.Add(new ContentPage
            {
                Title           = "Tab 1",
                BackgroundColor = Color.Aqua,
                Content         = new Label
                {
                    HorizontalTextAlignment = TextAlignment.Center,
                    VerticalTextAlignment   = TextAlignment.Center,
                    Text      = "TopTabbedPage - A Xamarin.Forms page with tabs at the top.",
                    TextColor = Color.DarkCyan,
                    Margin    = new Thickness(16)
                }
            });
            tabs.Children.Add(new ContentPage
            {
                Title           = "Tab 2",
                BackgroundColor = Color.Beige,
                Content         = new Label
                {
                    HorizontalTextAlignment = TextAlignment.Center,
                    VerticalTextAlignment   = TextAlignment.Center,
                    Text      = "TabsView internally wrapps MDTabBar.",
                    TextColor = Color.Green,
                    Margin    = new Thickness(16)
                }
            });
            tabs.CurrentPage = tabs.Children[1];
            await MainPage.Navigation.PushAsync(tabs);
        }
Пример #4
0
        public App()
        {
            InitializeComponent();

            var tabs = new TopTabbedPage
            {
                Title = "TopTabs",
                BarBackgroundColor = Color.FromHex("#FFFFFF"),
                BackgroundColor    = Color.FromHex("#FFFFFF"),
                SwipeEnabled       = false,
                BarIndicatorColor  = Color.FromHex("#ff831d"),
                BarTextColor       = Color.Black,
            };

            tabs.Children.Add(new MyPage
            {
                Title           = "My Page",
                BackgroundColor = Color.Aquamarine
            });
            tabs.Children.Add(new ContentPage
            {
                Title           = "Tab 1",
                BackgroundColor = Color.Aqua,
                Content         = new Label
                {
                    HorizontalTextAlignment = TextAlignment.Center,
                    VerticalTextAlignment   = TextAlignment.Center,
                    Text      = "TopTabbedPage - A Xamarin.Forms page with tabs at the top.",
                    TextColor = Color.DarkCyan,
                    Margin    = new Thickness(16)
                }
            });
            tabs.Children.Add(new ContentPage
            {
                Title           = "Tab 2",
                BackgroundColor = Color.Beige,
                Content         = new Label
                {
                    HorizontalTextAlignment = TextAlignment.Center,
                    VerticalTextAlignment   = TextAlignment.Center,
                    Text      = "TabsView internally wrapps MDTabBar.",
                    TextColor = Color.Green,
                    Margin    = new Thickness(16)
                }
            });
            tabs.Children.Add(new ContentPage
            {
                Title           = "Tab 3",
                BackgroundColor = Color.BlueViolet,
                Content         = new Label
                {
                    HorizontalTextAlignment = TextAlignment.Center,
                    VerticalTextAlignment   = TextAlignment.Center,
                    Text      = "TopTabbedPage could be embedded inside a NavigationPage.",
                    TextColor = Color.Aqua,
                    Margin    = new Thickness(16)
                }
            });

            {
                var stack = new StackLayout()
                {
                    Orientation       = StackOrientation.Vertical,
                    VerticalOptions   = new LayoutOptions(LayoutAlignment.Center, false),
                    HorizontalOptions = new LayoutOptions(LayoutAlignment.Center, false)
                };
                stack.Children.Add(new Label
                {
                    HorizontalTextAlignment = TextAlignment.Center,
                    VerticalTextAlignment   = TextAlignment.Center,
                    Text      = "TopTabbedPage is created while creating MyRide app showcase.",
                    TextColor = Color.DarkBlue,
                    Margin    = new Thickness(16)
                });
                var button = new Button()
                {
                    Text      = "Navigate",
                    TextColor = Color.DarkBlue,
                    Margin    = new Thickness(16)
                };
                button.Clicked += DidClickOnNavigateButton;
                stack.Children.Add(button);
                tabs.Children.Add(new ContentPage
                {
                    Title           = "Tab 4",
                    BackgroundColor = Color.LightYellow,
                    Content         = stack,
                });
            }
            //tabs.Children.Add(new ContentPage
            //{
            //	Title = "Tab 4",
            //	BackgroundColor = Color.LightYellow,
            //	Content = new Label
            //	{
            //		HorizontalTextAlignment = TextAlignment.Center,
            //		VerticalTextAlignment = TextAlignment.Center,
            //		Text = "TopTabbedPage is created while creating MyRide app showcase.",
            //                 TextColor = Color.DarkBlue,
            //		Margin = new Thickness(16)
            //	}
            //});
            tabs.Children.Add(new ContentPage
            {
                Title           = "Tab 5",
                BackgroundColor = Color.Bisque,
                Content         = new Label
                {
                    HorizontalTextAlignment = TextAlignment.Center,
                    VerticalTextAlignment   = TextAlignment.Center,
                    Text      = "TopTabbedPage is a product developed by NAXAM",
                    TextColor = Color.DarkGreen,
                    Margin    = new Thickness(16)
                }
            });

            tabs.ToolbarItems.Add(new ToolbarItem
            {
                Text    = "Toggle Swipe",
                Command = new Command(() => {
                    tabs.SwipeEnabled = !tabs.SwipeEnabled;
                })
            });

            var m = new NavigationPage(tabs)
            {
                BarBackgroundColor = Color.FromHex("9C27B0"),
                BarTextColor       = Color.White
            };

            m.PropertyChanged += (sender, e) =>
            {
                System.Diagnostics.Debug.WriteLine(e.PropertyName);
            };

            MainPage = m;

            //MainPage = tabs;
        }
        public App()
        {
            InitializeComponent();

            var tabs = new TopTabbedPage
            {
                Title = "Top Tabs",
                BarBackgroundColor = Color.FromHex("9C27B0"),
                //BarIndicatorColor = Color.DeepPink,
                //BarTextColor = Color.DeepPink
            };

            tabs.Children.Add(new MyPage
            {
                Title           = "My Page",
                BackgroundColor = Color.Aquamarine
            });
            tabs.Children.Add(new ContentPage {
                Title           = "Tab 1",
                BackgroundColor = Color.Aqua,
                Content         = new Label
                {
                    HorizontalTextAlignment = TextAlignment.Center,
                    VerticalTextAlignment   = TextAlignment.Center,
                    Text      = "TopTabbedPage - A Xamarin.Forms page with tabs at the top.",
                    TextColor = Color.DarkCyan,
                    Margin    = new Thickness(16)
                }
            });
            tabs.Children.Add(new ContentPage
            {
                Title           = "Tab 2",
                BackgroundColor = Color.Beige,
                Content         = new Label
                {
                    HorizontalTextAlignment = TextAlignment.Center,
                    VerticalTextAlignment   = TextAlignment.Center,
                    Text      = "TabsView internally wrapps MDTabBar.",
                    TextColor = Color.Green,
                    Margin    = new Thickness(16)
                }
            });
            tabs.Children.Add(new ContentPage
            {
                Title           = "Tab 3",
                BackgroundColor = Color.BlueViolet,
                Content         = new Label
                {
                    HorizontalTextAlignment = TextAlignment.Center,
                    VerticalTextAlignment   = TextAlignment.Center,
                    Text      = "TopTabbedPage could be embedded inside a NavigationPage.",
                    TextColor = Color.Aqua,
                    Margin    = new Thickness(16)
                }
            });

            {
                var stack = new StackLayout()
                {
                    Orientation       = StackOrientation.Vertical,
                    VerticalOptions   = new LayoutOptions(LayoutAlignment.Center, false),
                    HorizontalOptions = new LayoutOptions(LayoutAlignment.Center, false)
                };
                stack.Children.Add(new Label
                {
                    HorizontalTextAlignment = TextAlignment.Center,
                    VerticalTextAlignment   = TextAlignment.Center,
                    Text      = "TopTabbedPage is created while creating MyRide app showcase.",
                    TextColor = Color.DarkBlue,
                    Margin    = new Thickness(16)
                });
                var button = new Button()
                {
                    Text      = "Navigate",
                    TextColor = Color.DarkBlue,
                    Margin    = new Thickness(16)
                };
                button.Clicked += DidClickOnNavigateButton;
                stack.Children.Add(button);
                tabs.Children.Add(new ContentPage
                {
                    Title           = "Tab 4",
                    BackgroundColor = Color.LightYellow,
                    Content         = stack
                });
            }
            //tabs.Children.Add(new ContentPage
            //{
            //	Title = "Tab 4",
            //	BackgroundColor = Color.LightYellow,
            //	Content = new Label
            //	{
            //		HorizontalTextAlignment = TextAlignment.Center,
            //		VerticalTextAlignment = TextAlignment.Center,
            //		Text = "TopTabbedPage is created while creating MyRide app showcase.",
            //                 TextColor = Color.DarkBlue,
            //		Margin = new Thickness(16)
            //	}
            //});
            tabs.Children.Add(new ContentPage
            {
                Title           = "Tab 5",
                BackgroundColor = Color.Bisque,
                Content         = new Label {
                    HorizontalTextAlignment = TextAlignment.Center,
                    VerticalTextAlignment   = TextAlignment.Center,
                    Text      = "TopTabbedPage is a product developed by NAXAM",
                    TextColor = Color.DarkGreen,
                    Margin    = new Thickness(16)
                }
            });

            MainPage = new NavigationPage(tabs)
            {
                BarBackgroundColor = Color.FromHex("9C27B0"),
                BarTextColor       = Color.White
            };

            //MainPage = tabs;
        }
Пример #6
0
        public App()
        {
            InitializeComponent();

            var tabs = new TopTabbedPage
            {
                Title = "Top Tabs",
                BarBackgroundColor = Color.FromHex("9C27B0"),
                //BarIndicatorColor = Color.DeepPink,
                //BarTextColor = Color.DeepPink
            };

            tabs.Children.Add(new MyPage
            {
                Title           = "My Page",
                BackgroundColor = Color.Aquamarine
            });
            tabs.Children.Add(new ContentPage {
                Title           = "Tab 1",
                BackgroundColor = Color.Aqua,
                Content         = new Label
                {
                    HorizontalTextAlignment = TextAlignment.Center,
                    VerticalTextAlignment   = TextAlignment.Center,
                    Text      = "TopTabbedPage - A Xamarin.Forms page with tabs at the top.",
                    TextColor = Color.DarkCyan,
                    Margin    = new Thickness(16)
                }
            });
            tabs.Children.Add(new ContentPage
            {
                Title           = "Tab 2",
                BackgroundColor = Color.Beige,
                Content         = new Label
                {
                    HorizontalTextAlignment = TextAlignment.Center,
                    VerticalTextAlignment   = TextAlignment.Center,
                    Text      = "TabsView internally wrapps MDTabBar.",
                    TextColor = Color.Green,
                    Margin    = new Thickness(16)
                }
            });
            tabs.Children.Add(new ContentPage
            {
                Title           = "Tab 3",
                BackgroundColor = Color.BlueViolet,
                Content         = new Label
                {
                    HorizontalTextAlignment = TextAlignment.Center,
                    VerticalTextAlignment   = TextAlignment.Center,
                    Text      = "TopTabbedPage could be embedded inside a NavigationPage.",
                    TextColor = Color.Aqua,
                    Margin    = new Thickness(16)
                }
            });
            tabs.Children.Add(new ContentPage
            {
                Title           = "Tab 4",
                BackgroundColor = Color.LightYellow,
                Content         = new Label
                {
                    HorizontalTextAlignment = TextAlignment.Center,
                    VerticalTextAlignment   = TextAlignment.Center,
                    Text      = "TopTabbedPage is created while creating MyRide app showcase.",
                    TextColor = Color.DarkBlue,
                    Margin    = new Thickness(16)
                }
            });
            tabs.Children.Add(new ContentPage
            {
                Title           = "Tab 5",
                BackgroundColor = Color.Bisque,
                Content         = new Label {
                    HorizontalTextAlignment = TextAlignment.Center,
                    VerticalTextAlignment   = TextAlignment.Center,
                    Text      = "TopTabbedPage is a product developed by NAXAM",
                    TextColor = Color.DarkGreen,
                    Margin    = new Thickness(16)
                }
            });

            MainPage = new NavigationPage(tabs)
            {
                BarBackgroundColor = Color.FromHex("9C27B0"),
                BarTextColor       = Color.White
            };

            //MainPage = tabs;
        }