public ModalPopupWithNavigationPages()
        {
            Padding = 20;

            var button = new Forms9Patch.Button("Show Test Page");

            button.Clicked += (sender, e) => this.Navigation.PushModalAsync(new BubbonPushModalAsyncPage());
            // The root page of your application
            var content = new Xamarin.Forms.ContentView
            {
                //Title = "BubbleTest",
                Content = new Xamarin.Forms.StackLayout
                {
                    VerticalOptions = LayoutOptions.Center,
                    Children        =
                    {
                        new Xamarin.Forms.Label {
                            HorizontalTextAlignment = TextAlignment.Center,
                            Text = "Welcome to Xamarin Forms!"
                        },
                        button,
                    }
                }
            };

            Content = content;
        }
        public BubbonPushModalAsyncPage()
        {
            Padding = 20;

            button1 = new Forms9Patch.Button("No Target");
            button2 = new Forms9Patch.Button("Target");


            Content = new Xamarin.Forms.StackLayout
            {
                VerticalOptions = LayoutOptions.Center,
                Children        =
                {
                    button1,
                    button2,
                    returnButton,
                }
            };

            bubble = new BubblePopup(button1)
            {
                Padding         = 25,
                BackgroundColor = Color.Blue,
                //Target = button, // Uncomment this line, and it crashes too
                Content = new Xamarin.Forms.StackLayout
                {
                    Children =
                    {
                        new Xamarin.Forms.Label {
                            Text = "This is a test bubble"
                        }
                    }
                }
            };

            button1.Clicked += (sender, e) =>
            {
                bubble.Target    = null;
                bubble.IsVisible = true;
            };

            button2.Clicked += (sender, e) =>
            {
                bubble.Target    = button1;
                bubble.IsVisible = true;
            };

            returnButton.Clicked += (sender, e) =>
            {
                this.Navigation.PopModalAsync();
            };
        }
Example #3
0
        public ButtonTapped()
        {
            Padding = 40;

            var button = new Forms9Patch.Button
            {
                Text            = "Button",
                TextColor       = Color.Pink,
                FontSize        = 20,
                HeightRequest   = 30,
                WidthRequest    = 200,
                OutlineColor    = Color.Pink,
                OutlineRadius   = 5,
                OutlineWidth    = 2,
                IsVisible       = true,
                BackgroundColor = Color.White,
            };

            button.Tapped += OnTapped;

            var stateButton = new StateButton
            {
                Text            = "StateButton",
                TextColor       = Color.Green,
                FontSize        = 20,
                HeightRequest   = 30,
                WidthRequest    = 200,
                OutlineColor    = Color.Green,
                OutlineRadius   = 5,
                OutlineWidth    = 2,
                IsVisible       = true,
                BackgroundColor = Color.White
            };

            stateButton.Tapped += OnTapped;

            Content = new Xamarin.Forms.StackLayout
            {
                Children =
                {
                    button, stateButton
                }
            };
        }
Example #4
0
        public PopupsPage()
        {
            Padding = 20;
            _hzLayoutOptions.SelectIndex(1);
            _vtLayoutOptions.SelectIndex(1);

            #region ModalPopup
            cancelModalButton.Clicked += async(sender, e) => await _modalPopup.CancelAsync();

            popPushModalButton.Clicked += (sender, e) =>
            {
                _modalPopup.IsVisible = false;
                _modalPopup.IsVisible = true;
            };
            showModalButton.Clicked += (sender, e) =>
            {
                _modalPopup.HasShadow         = _hasShadow;
                _modalPopup.ShadowInverted    = _shadowInverted;
                _modalPopup.OutlineWidth      = _blueOutline ? 1 : 0;
                _modalPopup.IsVisible         = true;
                _modalPopup.HorizontalOptions = LayoutOption(_hzLayoutOptions);
                _modalPopup.VerticalOptions   = LayoutOption(_vtLayoutOptions);
            };
            #endregion


            #region BubblePopups


            var showBubbleLeftButton = new Forms9Patch.Button(bubbleLeftText)
            {
                BackgroundColor = Color.White, HorizontalOptions = LayoutOptions.Center
            };
            var showBubbleRightButton = new Forms9Patch.Button(bubbleRightText)
            {
                BackgroundColor = Color.White, HorizontalOptions = LayoutOptions.Center
            };
            var showBubbleUpButton = new Forms9Patch.Button(bubbleUpText)
            {
                BackgroundColor = Color.White, HorizontalOptions = LayoutOptions.Center
            };
            var showBubbleDownButton = new Forms9Patch.Button(bubbleDownText)
            {
                BackgroundColor = Color.White, HorizontalOptions = LayoutOptions.Center
            };
            var showBubbleHzButton = new Forms9Patch.Button(bubbleHzText)
            {
                BackgroundColor = Color.White, HorizontalOptions = LayoutOptions.Center
            };
            var showBubbleVtButton = new Forms9Patch.Button(bubbleVtText)
            {
                BackgroundColor = Color.White, HorizontalOptions = LayoutOptions.Center
            };
            var showBubbleAnyButton = new Forms9Patch.Button(bubbleAnyText)
            {
                BackgroundColor = Color.White, HorizontalOptions = LayoutOptions.Center
            };
            var showBubbleNoneButton = new Forms9Patch.Button(bubbleNoneText)
            {
                BackgroundColor = Color.White, HorizontalOptions = LayoutOptions.Center
            };

            var bubblePointerDirectionControl = new SegmentedControl
            {
                Segments =
                {
                    new Segment("←"),
                    new Segment("↑"),
                    new Segment("→"),
                    new Segment("↓"),
                    new Segment("↔"),
                    new Segment("↕"),
                    new Segment("↔ ↕"),
                    new Segment(" ")
                },
                SyncSegmentFontSizes = false,
            };

            var cancelBubbleButton = new Forms9Patch.Button("CANCEL");

            var bubbleTarget = new Forms9Patch.Frame
            {
                OutlineWidth      = 1,
                OutlineColor      = Color.Black,
                OutlineRadius     = 4,
                Content           = new Forms9Patch.Label("BUBBLE TARGET"),
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
            };

            bubble = new BubblePopup(bubbleTarget)
            {
                Content = new Xamarin.Forms.StackLayout
                {
                    Children =
                    {
                        new Forms9Patch.Label("BubblePopup")
                        {
                            FontAttributes = FontAttributes.Bold
                        },
                        bubblePointerDirectionControl,
                        cancelBubbleButton
                    },
                },
            };

            bubblePointerDirectionControl.SegmentTapped += (sender, e) =>
            {
                switch (e.Segment.Text)
                {
                case "←": bubble.PointerDirection = PointerDirection.Left; break;

                case "↑": bubble.PointerDirection = PointerDirection.Up; break;

                case "→": bubble.PointerDirection = PointerDirection.Right; break;

                case "↓": bubble.PointerDirection = PointerDirection.Down; break;

                case "↔": bubble.PointerDirection = PointerDirection.Horizontal; break;

                case "↕": bubble.PointerDirection = PointerDirection.Vertical; break;

                case "↔↕": bubble.PointerDirection = PointerDirection.Any; break;

                case " ": bubble.PointerDirection = PointerDirection.None; break;
                }
            };

            cancelBubbleButton.Clicked += async(sender, e) => await bubble.CancelAsync();

            showBubbleLeftButton.Clicked  += OnBubbleButtonClicked;
            showBubbleRightButton.Clicked += OnBubbleButtonClicked;
            showBubbleUpButton.Clicked    += OnBubbleButtonClicked;
            showBubbleDownButton.Clicked  += OnBubbleButtonClicked;
            showBubbleHzButton.Clicked    += OnBubbleButtonClicked;
            showBubbleVtButton.Clicked    += OnBubbleButtonClicked;
            showBubbleAnyButton.Clicked   += OnBubbleButtonClicked;
            showBubbleNoneButton.Clicked  += OnBubbleButtonClicked;
            #endregion


            #region ActivityPopup
            Forms9Patch.Button showActivityPopupButton = new Forms9Patch.Button("ActivityIndicatorPopup")
            {
                BackgroundColor = Color.White
            };
            showActivityPopupButton.Clicked += (sender, e) =>
            {
                //var activity = Forms9Patch.ActivityIndicatorPopup.Create();
                _activity.CancelOnPageOverlayTouch = true;
                _activity.IsVisible = true;
            };
            #endregion


            #region PermissionPopup
            var showPermissionButton = new Forms9Patch.Button("PermissionPopup")
            {
                BackgroundColor = Color.White
            };
            showPermissionButton.Clicked += (sender, e) =>
            {
                var permission = PermissionPopup.Create("PermissionPopup", "Do you agree?");
                permission.HorizontalOptions = LayoutOption(_hzLayoutOptions);
                permission.VerticalOptions   = LayoutOption(_vtLayoutOptions);
                permission.OutlineColor      = Color.Blue;
                permission.HasShadow         = _hasShadow;
                permission.ShadowInverted    = _shadowInverted;
                permission.OutlineWidth      = _blueOutline ? 1 : 0;
            };
            #endregion


            #region Toast
            var showToastButton = new Forms9Patch.Button("Toast")
            {
                BackgroundColor = Color.White
            };
            showToastButton.Clicked += (sender, e) =>
            {
                var toast = Toast.Create("Toast", "... of the town!");
                toast.OutlineColor      = Color.Blue;
                toast.HasShadow         = _hasShadow;
                toast.ShadowInverted    = _shadowInverted;
                toast.OutlineWidth      = _blueOutline ? 1 : 0;
                toast.HorizontalOptions = LayoutOption(_hzLayoutOptions);
                toast.VerticalOptions   = LayoutOption(_vtLayoutOptions);
            };
            #endregion


            #region TargetedToast
            var showTargetedToash = new Forms9Patch.Button("TargetedToast")
            {
                BackgroundColor = Color.White
            };
            showTargetedToash.Clicked += (sender, e) =>
            {
                var toast = TargetedToast.Create(showTargetedToash, "TargetedToast", "... has the far getted most!");
                toast.OutlineColor      = Color.Blue;
                toast.HasShadow         = _hasShadow;
                toast.ShadowInverted    = _shadowInverted;
                toast.OutlineWidth      = _blueOutline ? 1 : 0;
                toast.HorizontalOptions = LayoutOption(_hzLayoutOptions);
                toast.VerticalOptions   = LayoutOption(_vtLayoutOptions);
            };
            #endregion


            #region TargetedMenu
            showTargetedMenu = new Forms9Patch.Button("TargetedMenu")
            {
                BackgroundColor = Color.White
            };
            var targetedMenu = new Forms9Patch.TargetedMenu(showTargetedMenu)
            {
                Segments =
                {
                    new Segment("Copy",       "<font face=\"Forms9PatchDemo.Resources.Fonts.MaterialIcons-Regular.ttf\">&#xE14D;</font>"),
                    new Segment("Cut",        "<font face=\"Forms9PatchDemo.Resources.Fonts.MaterialIcons-Regular.ttf\">&#xE14E;</font>"),
                    new Segment("Paste",      "<font face=\"Forms9PatchDemo.Resources.Fonts.MaterialIcons-Regular.ttf\">&#xE14F;</font>"),
                    new Segment("Segment A"),
                    new Segment("Segment B"),
                    new Segment("Segment C"),
                    new Segment("Segment D"),
                    new Segment("Segment E"),
                    new Segment("Segment F"),
                    new Segment("Segment G"),
                    new Segment("Segment H"),
                },
                TextColor = Color.White
            };
            showTargetedMenu.Clicked += (s, e) =>
            {
                targetedMenu.IsVisible      = true;
                targetedMenu.HasShadow      = _hasShadow;
                targetedMenu.ShadowInverted = _shadowInverted;
                targetedMenu.IsVisible      = true;
            };
            targetedMenu.SegmentTapped += (s, e) => System.Diagnostics.Debug.WriteLine("TargetedMenu.SegmentTapped: " + e.Segment.Text);
            #endregion


            #region Vertical TargetedMenu
            var showVerticalTargetedMenu = new Forms9Patch.Button("Vertical TargetedMenu")
            {
                BackgroundColor = Color.White
            };
            var verticalTargetedMenu = new Forms9Patch.TargetedMenu(showVerticalTargetedMenu)
            {
                Orientation = StackOrientation.Vertical,
                Segments    =
                {
                    new Segment("Copy",       "<font face=\"Forms9PatchDemo.Resources.Fonts.MaterialIcons-Regular.ttf\">&#xE14D;</font>"),
                    new Segment("Cut",        "<font face=\"Forms9PatchDemo.Resources.Fonts.MaterialIcons-Regular.ttf\">&#xE14E;</font>"),
                    new Segment("Paste",      "<font face=\"Forms9PatchDemo.Resources.Fonts.MaterialIcons-Regular.ttf\">&#xE14F;</font>"),
                    new Segment("Segment A"),
                    new Segment("Segment B"),
                    new Segment("Segment C"),
                    new Segment("Segment D"),
                    new Segment("Segment E"),
                    new Segment("Segment F"),
                    new Segment("Segment G"),
                    new Segment("Segment H"),
                },
            };
            showVerticalTargetedMenu.Clicked += (s, e) =>
            {
                //verticalTargetedMenu.OutlineColor = Color.Blue;
                verticalTargetedMenu.IsVisible      = true;
                verticalTargetedMenu.HasShadow      = _hasShadow;
                verticalTargetedMenu.ShadowInverted = _shadowInverted;
                verticalTargetedMenu.IsVisible      = true;
            };
            verticalTargetedMenu.SegmentTapped += (s, e) => System.Diagnostics.Debug.WriteLine("TargetedMenu.SegmentTapped: " + e.Segment.Text);
            #endregion


            #region SoftwareKeyboardTest

            var yearPicker = new Xamarin.Forms.Picker
            {
                Title       = "SELECT YEAR",
                ItemsSource = new List <string> {
                    "SELECT YEAR", "2000", "2001", "2002", "2003", "2004", "2005", "2006", "2006", "2008", "2009", "2010", "2011", "2012", "2013", "2014", "2015", "2016", "2017", "2018", "2019", "2020"
                },
                SelectedItem  = "SELECT YEAR",
                SelectedIndex = 0,
                TextColor     = Color.LightGray,
            };
            yearPicker.SelectedIndexChanged += (s, e) => yearPicker.TextColor = yearPicker.SelectedIndex == 0 ? Color.LightGray : Color.Blue;

            var monthPicker = new Xamarin.Forms.Picker
            {
                Title       = "SELECT MONTH",
                ItemsSource = new List <string> {
                    "SELECT MONTH", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
                },
                SelectedItem = "SELECT MONTH",
                TextColor    = Color.LightGray,
            };
            monthPicker.SelectedIndexChanged += (s, e) => monthPicker.TextColor = monthPicker.SelectedIndex == 0 ? Color.LightGray : Color.Blue;


            var softwareKeyboardTestButton = new Forms9Patch.Button("Software Keyboard Test")
            {
                BackgroundColor = Color.White
            };
            var softwareKeyboardTestPopup = new ModalPopup
            {
                HorizontalOptions = LayoutOption(_hzLayoutOptions),
                VerticalOptions   = LayoutOption(_vtLayoutOptions),
                Content           =
                    new Xamarin.Forms.StackLayout
                {
                    Children =
                    {
                        yearPicker,
                        monthPicker,
                        new Xamarin.Forms.Entry
                        {
                            Placeholder      = "ENTER FIRST NAME",
                            TextColor        = Color.Blue,
                            PlaceholderColor = Color.LightGray,
                        },
                        new Xamarin.Forms.Entry
                        {
                            Placeholder      = "ENTER LAST NAME",
                            TextColor        = Color.Blue,
                            PlaceholderColor = Color.LightGray,
                        },
                    }
                }
            };
            softwareKeyboardTestButton.Clicked += (s, e) =>
            {
                softwareKeyboardTestPopup.OutlineColor      = Color.Blue;
                softwareKeyboardTestPopup.HasShadow         = _hasShadow;
                softwareKeyboardTestPopup.ShadowInverted    = _shadowInverted;
                softwareKeyboardTestPopup.OutlineWidth      = _blueOutline ? 1 : 0;
                softwareKeyboardTestPopup.IsVisible         = true;
                softwareKeyboardTestPopup.HorizontalOptions = LayoutOption(_hzLayoutOptions);
                softwareKeyboardTestPopup.VerticalOptions   = LayoutOption(_vtLayoutOptions);
            };
            #endregion

            Content = new Xamarin.Forms.ScrollView
            {
                Content = new Xamarin.Forms.StackLayout
                {
                    Children =
                    {
                        new BoxView {
                            HeightRequest = 1
                        },
                        _decoration,
                        new Forms9Patch.Label("HZ LAYOUT ALIGNMENT:"),
                        _hzLayoutOptions,
                        new Forms9Patch.Label("VT LAYOUT ALIGNMENT:"),
                        _vtLayoutOptions,
                        new BoxView {
                            HeightRequest = 1
                        },
                        showModalButton,
                        showBubbleLeftButton,
                        showBubbleRightButton,
                        showBubbleUpButton,
                        showBubbleDownButton,
                        showBubbleHzButton,
                        showBubbleVtButton,
                        showBubbleAnyButton,
                        showBubbleNoneButton,
                        bubbleTarget,
                        showActivityPopupButton,
                        showPermissionButton,
                        showToastButton,
                        showTargetedToash,
                        showTargetedMenu,
                        showVerticalTargetedMenu,
                        softwareKeyboardTestButton,
                        new BoxView {
                            HeightRequest = 1
                        },
                    }
                }
            };

            _decoration.SegmentTapped += (s, e) =>
            {
                switch (e.Segment.Text)
                {
                case _hasShadowText:
                    _hasShadow = !_hasShadow;
                    break;

                case _shadowInvertedText:
                    _shadowInverted = !_shadowInverted;
                    break;

                case _blueOutlineText:
                    _blueOutline = !_blueOutline;
                    break;
                }
            };

            BackgroundColor = Color.LightSlateGray;
        }
Example #5
0
        public PopupsPage()
        {
            Padding = 20;

            var showModalButton   = new Forms9Patch.Button("ModalPopup");
            var cancelModalButton = new Forms9Patch.Button("CANCEL");
            var modal             = new ModalPopup
            {
                Content = new Xamarin.Forms.StackLayout
                {
                    Children =
                    {
                        new Forms9Patch.Label("ModalPopup")
                        {
                            FontAttributes = FontAttributes.Bold
                        },
                        cancelModalButton
                    }
                }
            };

            cancelModalButton.Clicked += (sender, e) => modal.Cancel();
            showModalButton.Clicked   += (sender, e) => modal.IsVisible = true;

            var showBubbleButton   = new Forms9Patch.Button("BubblePopup");
            var cancelBubbleButton = new Forms9Patch.Button("CANCEL");
            var bubble             = new BubblePopup(showBubbleButton)
            {
                Content = new Xamarin.Forms.StackLayout
                {
                    Children =
                    {
                        new Forms9Patch.Label("BubblePopup")
                        {
                            FontAttributes = FontAttributes.Bold
                        },
                        cancelBubbleButton
                    }
                }
            };

            cancelBubbleButton.Clicked += (sender, e) => bubble.Cancel();
            showBubbleButton.Clicked   += (sender, e) => bubble.IsVisible = true;

            var showActivityButton = new Forms9Patch.Button("ActivityIndicatorPopup");

            showActivityButton.Clicked += (sender, e) =>
            {
                var activity = Forms9Patch.ActivityIndicatorPopup.Create();
                activity.CancelOnPageOverlayTouch = true;
            };

            var showPermissionButton = new Forms9Patch.Button("PermissionPopup");

            showPermissionButton.Clicked += (sender, e) =>
            {
                var permission = PermissionPopup.Create("PermissionPopup", "Do you agree?");
            };

            var showToastButton = new Forms9Patch.Button("Toast");

            showToastButton.Clicked += (sender, e) => Toast.Create("Toast", "... of the town!");

            var showTargetedToash = new Forms9Patch.Button("TargetedToast");

            showTargetedToash.Clicked += (sender, e) => TargetedToast.Create(showTargetedToash, "TargetedToast", "... has the far getted most!");

            Content = new Xamarin.Forms.StackLayout
            {
                Children = { showModalButton, showBubbleButton, showActivityButton, showPermissionButton, showToastButton, showTargetedToash }
            };
        }