Esempio n. 1
0
        void DoNavigation()
        {
            var tab1 = GetNavigationPage("One");
            var tab2 = GetNavigationPage("Two");
            var tab3 = GetNavigationPage("Three");
            var tab4 = GetNavigationPage("Four");
            var tab5 = GetNavigationPage("Five");

            var menuNavigationPage = GetNavigationPage("Menu");

            CreateAndPushPageForNavigationPage(menuNavigationPage);

            var tabbedPage = new TabbedPage();

            tabbedPage.Children.Add(tab1);
            tabbedPage.Children.Add(tab2);
            tabbedPage.Children.Add(tab3);
            tabbedPage.Children.Add(tab4);
            tabbedPage.Children.Add(tab5);

            tabbedPage.Title = "tabbed";

            tabbedPage.On <PlatformConfiguration.Android>().SetToolbarPlacement(ToolbarPlacement.Bottom);
            tabbedPage.On <PlatformConfiguration.Android>().SetIsSwipePagingEnabled(false);
            tabbedPage.On <PlatformConfiguration.Android>().SetIsSmoothScrollEnabled(false);
            tabbedPage.On <PlatformConfiguration.Android>().SetOffscreenPageLimit(4);

            CreateAndPushPageForNavigationPage(tab1);
            CreateAndPushPageForNavigationPage(tab2);
            CreateAndPushPageForNavigationPage(tab3);
            CreateAndPushPageForNavigationPage(tab4);
            CreateAndPushPageForNavigationPage(tab5);

            Flyout = menuNavigationPage;
            Detail = tabbedPage;
        }
Esempio n. 2
0
        internal static void SetupTabbedPage(TabbedPage tabbedPage, AToolbarPlacement placement)
        {
            ContentPage Issue1898PageOne = new ContentPage()
            {
                Title = Title1, IconImageSource = "bank.png"
            };
            ContentPage Issue1898PageTwo = new ContentPage()
            {
                Title = Title2, IconImageSource = "bank.png"
            };

            Issue1898PageOne.Content =
                new StackLayout
            {
                Margin   = 20,
                Children =
                {
                    new Label()
                    {
                        Text = "Click through each button on each tab to make sure they do what they say they do"
                    },
                    new Button()
                    {
                        Text = ChangeTitle1, Command = new Command(() => Issue1898PageOne.Title = ChangeTitle1)
                    },
                    new Button()
                    {
                        Text = ChangeIcon1, Command = new Command(() => Issue1898PageOne.IconImageSource = "coffee.png")
                    },
                    new Button()
                    {
                        Text = ChangeIconPage2, Command = new Command(() => Issue1898PageTwo.IconImageSource = "coffee.png")
                    },
                    new Button()
                    {
                        Text = ChangeIcon1Null, Command = new Command(() => Issue1898PageOne.IconImageSource = null)
                    },
                }
            };

            Issue1898PageTwo.Content =
                new StackLayout
            {
                Margin   = 20,
                Children =
                {
                    new Button()
                    {
                        Text = ChangeTitle2, Command = new Command(() => Issue1898PageTwo.Title = ChangeTitle2)
                    },
                    new Button()
                    {
                        Text = ChangeIcon2, Command = new Command(() => Issue1898PageTwo.IconImageSource = "bank.png")
                    },
                    new Button()
                    {
                        Text = ChangeIconPage1, Command = new Command(() => Issue1898PageOne.IconImageSource = "calculator.png")
                    },
                    new Button()
                    {
                        Text = ChangeIcon2Null, Command = new Command(() => Issue1898PageTwo.IconImageSource = null)
                    },
                }
            };

            tabbedPage.Children.Add(Issue1898PageOne);
            tabbedPage.Children.Add(Issue1898PageTwo);

            tabbedPage.On <Android>().Element.UnselectedTabColor = Colors.Blue;
            tabbedPage.On <Android>().Element.SelectedTabColor   = Colors.Green;
            tabbedPage.On <Android>().SetToolbarPlacement(placement);
            tabbedPage.On <WindowsOS>().SetHeaderIconsEnabled(true);
        }
        public HeaderIconsControlPage(TabbedPage target)
        {
            _target = target;

            _toggleIconsButton          = new Button();
            _toggleIconsButton.Text     = "Show Header Icons";
            _toggleIconsButton.Clicked += (object sender, EventArgs e) => {
                if (_target.On <Windows>().IsHeaderIconsEnabled())
                {
                    _target.On <Windows>().DisableHeaderIcons();
                    _toggleIconsButton.Text = "Show Header Icons";
                }
                else
                {
                    _target.On <Windows>().EnableHeaderIcons();
                    _toggleIconsButton.Text = "Hide Header Icons";
                }
            };

            var iconWidthLabel = new Label {
                Text = "Head Icons Width:"
            };
            var iconHeightLabel = new Label {
                Text = "Head Icons Height:"
            };

            _iconWidthEntry = new Entry {
                Text = "16"
            };
            _iconHeightEntry = new Entry {
                Text = "16"
            };

            _changeIconsSizeButton          = new Button();
            _changeIconsSizeButton.Text     = "Change Header Icons Size";
            _changeIconsSizeButton.Clicked += (object sender, EventArgs e) => {
                int width;
                int height;

                if (!Int32.TryParse(_iconWidthEntry.Text, out width))
                {
                    width = 16;
                }
                if (!Int32.TryParse(_iconHeightEntry.Text, out height))
                {
                    height = 16;
                }

                var currentSize = _target.On <Windows>().GetHeaderIconsSize();
                if (currentSize.Width != width || currentSize.Height != height)
                {
                    _target.On <Windows>().SetHeaderIconsSize(new Size(width, height));
                }
            };

            _getCurrentIconsSizeButton          = new Button();
            _getCurrentIconsSizeButton.Text     = "Load Current Header Icons Size";
            _getCurrentIconsSizeButton.Clicked += (object sender, EventArgs e) => {
                var currentSize = _target.On <Windows>().GetHeaderIconsSize();
                _iconWidthEntry.Text  = currentSize.Width.ToString();
                _iconHeightEntry.Text = currentSize.Height.ToString();
            };

            Content = new StackLayout {
                Padding = new Thickness(0, 16), Children =
                {
                    new Label {
                        Text = "Control page for header icons on UWP.", FontAttributes = FontAttributes.Bold
                    },
                    _toggleIconsButton, iconWidthLabel, _iconWidthEntry, iconHeightLabel, _iconHeightEntry, _changeIconsSizeButton,
                    _getCurrentIconsSizeButton
                }
            };
        }
Esempio n. 4
0
        internal static void SetupTabbedPage(TabbedPage tabbedPage, AToolbarPlacement placement)
        {
            ContentPage Issue1898PageOne = new ContentPage()
            {
                Title = Title1, Icon = "bank.png"
            };
            ContentPage Issue1898PageTwo = new ContentPage()
            {
                Title = Title2, Icon = "bank.png"
            };

            Issue1898PageOne.Content =
                new StackLayout
            {
                Margin   = 20,
                Children =
                {
                    new Label()
                    {
                        Text = "Click through each button on each tab to make sure they do what they say they do"
                    },
                    new Button()
                    {
                        Text = ChangeTitle1, Command = new Command(() => Issue1898PageOne.Title = ChangeTitle1)
                    },
                    new Button()
                    {
                        Text = ChangeIcon1, Command = new Command(() => Issue1898PageOne.Icon = "coffee.png")
                    },
                    new Button()
                    {
                        Text = ChangeIconPage2, Command = new Command(() => Issue1898PageTwo.Icon = "coffee.png")
                    },
                    new Button()
                    {
                        Text = ChangeIcon1Null, Command = new Command(() => Issue1898PageOne.Icon = null)
                    },
                }
            };

            Issue1898PageTwo.Content =
                new StackLayout
            {
                Margin   = 20,
                Children =
                {
                    new Button()
                    {
                        Text = ChangeTitle2, Command = new Command(() => Issue1898PageTwo.Title = ChangeTitle2)
                    },
                    new Button()
                    {
                        Text = ChangeIcon2, Command = new Command(() => Issue1898PageTwo.Icon = "bank.png")
                    },
                    new Button()
                    {
                        Text = ChangeIconPage1, Command = new Command(() => Issue1898PageOne.Icon = "calculator.png")
                    },
                    new Button()
                    {
                        Text = ChangeIcon2Null, Command = new Command(() => Issue1898PageTwo.Icon = null)
                    },
                }
            };

            tabbedPage.Children.Add(Issue1898PageOne);
            tabbedPage.Children.Add(Issue1898PageTwo);

#pragma warning disable CS0618 // Type or member is obsolete
            tabbedPage.On <Android>().SetBarItemColor(Color.Blue);
            tabbedPage.On <Android>().SetBarSelectedItemColor(Color.Green);
#pragma warning restore CS0618 // Type or member is obsolete
            tabbedPage.On <Android>().SetToolbarPlacement(placement);
            tabbedPage.On <Windows>().SetHeaderIconsEnabled(true);
        }