コード例 #1
0
        public ModalPopupTestPage()
        {
            BackgroundColor = Color.White;
            Padding         = new Thickness(20, Device.OnPlatform(20, 0, 0), 20, 20);

            var shadowToggle = new Switch();

            shadowToggle.SetBinding(Switch.IsToggledProperty, "HasShadow");
            shadowToggle.BindingContext = this;

            var shadowInvertedToggle = new Switch();

            shadowInvertedToggle.SetBinding(Switch.IsToggledProperty, "ShadowInverted");
            shadowInvertedToggle.BindingContext = this;

            var cornerRadiusSlider = new Slider
            {
                Maximum       = 40,
                Minimum       = 0,
                HeightRequest = 20,
            };

            cornerRadiusSlider.SetBinding(Slider.ValueProperty, "CornerRadius");
            cornerRadiusSlider.BindingContext = this;

            var paddingSlider = new Slider
            {
                Maximum       = 100,
                Minimum       = 0,
                HeightRequest = 20,
            };

            paddingSlider.SetBinding(Slider.ValueProperty, "PUDPadding");
            paddingSlider.BindingContext = this;

            //var listener = new FormsOrientation.Listener ();

            var hidePopupButton = new Forms9Patch.MaterialButton
            {
                Text            = "DONE",
                BackgroundColor = Color.Blue,
                DarkTheme       = true,
            };
            var showPopupButton = new Forms9Patch.MaterialButton
            {
                Text              = "Show Modal popup",
                BackgroundColor   = Color.Blue,
                DarkTheme         = true,
                WidthRequest      = 150,
                HorizontalOptions = LayoutOptions.Center,
            };

            var cancelOnBackgroundTouchButton = new Forms9Patch.MaterialButton
            {
                Text           = "Cancel on Background touch",
                ToggleBehavior = true,
                IsSelected     = true
            };

            cancelOnBackgroundTouchButton.SetBinding(Forms9Patch.MaterialButton.IsSelectedProperty, "CancelOnBackgroundTouch");
            cancelOnBackgroundTouchButton.BindingContext = this;


            var blackSegment = new Forms9Patch.Segment {
                HtmlText = "<font color=\"#000000\">Black</font>"
            };
            var redSegment = new Forms9Patch.Segment {
                HtmlText = "<font color=\"#FF0000\">Red</font>"
            };
            var greenSegment = new Forms9Patch.Segment {
                HtmlText = "<font color=\"#00FF00\">Green</font>"
            };
            var blueSegment = new Forms9Patch.Segment {
                HtmlText = "<font color=\"#0000FF\">Blue</font>"
            };

            var overlayColorSelector = new Forms9Patch.MaterialSegmentedControl
            {
                Segments =
                {
                    blackSegment,
                    redSegment,
                    greenSegment,
                    blueSegment,
                },
                BackgroundColor = Color.White
            };

            var modal = new Forms9Patch.ModalPopup
            {
                Content = new StackLayout
                {
                    Children =
                    {
                        new Label {
                            Text      = "Hello Modal popup!",
                            TextColor = Color.Black,
                        },
                        new Label {
                            Text = "Padding:", FontSize = 10,
                        },
                        paddingSlider,
                        new Label {
                            Text = "Corner Radius:", FontSize = 10,
                        },
                        cornerRadiusSlider,
                        hidePopupButton,
                        new Label {
                            Text = "PageOverlayColor:", FontSize = 10,
                        },
                        overlayColorSelector
                    },
                    //BackgroundColor = Color.FromRgb(100,100,100),
                    //Padding = 20,
                },
                OutlineRadius   = 4,
                OutlineWidth    = 1,
                OutlineColor    = Color.Black,
                BackgroundColor = Color.Aqua,
                HasShadow       = true,
                HeightRequest   = 200,
                WidthRequest    = 200,
            };

            modal.SetBinding(Forms9Patch.ModalPopup.OutlineRadiusProperty, "CornerRadius");
            modal.SetBinding(Forms9Patch.ModalPopup.OutlineWidthProperty, "OutlineWidth");
            modal.SetBinding(Forms9Patch.ModalPopup.PaddingProperty, "PUPadding");
            modal.SetBinding(Forms9Patch.ModalPopup.HasShadowProperty, "HasShadow");
            modal.SetBinding(Forms9Patch.ModalPopup.ShadowInvertedProperty, "ShadowInverted");
            modal.SetBinding(Forms9Patch.ModalPopup.CancelOnPageOverlayTouchProperty, "CancelOnBackgroundTouch");
            modal.BindingContext = this;


            showPopupButton.Tapped += (sender, e) =>
            {
                modal.IsVisible = true;
            };
            hidePopupButton.Tapped += (sender, e) =>
            {
                modal.IsVisible = false;
                System.Diagnostics.Debug.WriteLine("button " + showPopupButton.Text);
            };

            blackSegment.Selected += (sender, e) => { modal.PageOverlayColor = Color.FromRgba(0, 0, 0, 128); };
            redSegment.Selected   += (sender, e) => { modal.PageOverlayColor = Color.FromRgba(255, 0, 0, 128); };
            greenSegment.Selected += (sender, e) => { modal.PageOverlayColor = Color.FromRgba(0, 255, 0, 128); };
            blueSegment.Selected  += (sender, e) => { modal.PageOverlayColor = Color.FromRgba(0, 0, 255, 128); };

            Detail = new ContentPage
            {
                BackgroundColor = Color.White,
                Title           = "PopupTestPage - Detail",
                Content         = new StackLayout
                {
                    Children =
                    {
                        new Label                 {
                            Text      = "Hello ContentPage",
                            TextColor = Color.Black,
                        },
                        new StackLayout           {
                            Orientation = StackOrientation.Horizontal,
                            Children    =
                            {
                                new StackLayout   {
                                    Children =
                                    {
                                        new Label {
                                            Text = "Has Shadow", FontSize = 10,
                                        },
                                        shadowToggle,
                                    },
                                    HorizontalOptions = LayoutOptions.StartAndExpand,
                                },
                                new StackLayout   {
                                    Children =
                                    {
                                        new Label {
                                            Text = "Inset Shadow", FontSize = 10,
                                        },
                                        shadowInvertedToggle,
                                    },
                                    HorizontalOptions = LayoutOptions.EndAndExpand,
                                }
                            }
                        },
                        cancelOnBackgroundTouchButton,
                        showPopupButton,
                    },
                    Padding = 20,
                },
            };

            Master = new ContentPage
            {
                Title   = "PopupTestPage - Master",
                Content = new Label
                {
                    Text = "Master Page",
                },
                BackgroundColor = Color.Gray,
            };
        }
コード例 #2
0
        public NestedBubblePopupPage()
        {
            BackgroundColor = Color.White;
            switch (Device.RuntimePlatform)
            {
            case Device.iOS:
                Padding = new Thickness(20);
                break;

            default:
                Padding = new Thickness(20, 0, 20, 20);
                break;
            }


            var shadowToggle = new Switch();

            shadowToggle.SetBinding(Switch.IsToggledProperty, "HasShadow");
            shadowToggle.BindingContext = this;

            var shadowInvertedToggle = new Switch();

            shadowInvertedToggle.SetBinding(Switch.IsToggledProperty, "ShadowInverted");
            shadowInvertedToggle.BindingContext = this;

            var cornerRadiusSlider = new Slider
            {
                Maximum       = 40,
                Minimum       = 0,
                HeightRequest = 20,
            };

            cornerRadiusSlider.SetBinding(Slider.ValueProperty, "CornerRadius");
            cornerRadiusSlider.BindingContext = this;

            var pointerLengthSlider = new Slider
            {
                Maximum       = 40,
                Minimum       = 0,
                HeightRequest = 20,
            };

            pointerLengthSlider.SetBinding(Slider.ValueProperty, "PointerLength");
            pointerLengthSlider.BindingContext = this;

            var pointerTipRadiusSlider = new Slider
            {
                Maximum       = 20,
                Minimum       = 0,
                HeightRequest = 20,
            };

            pointerTipRadiusSlider.SetBinding(Slider.ValueProperty, "PointerTipRadius");
            pointerTipRadiusSlider.BindingContext = this;

            var paddingSlider = new Slider
            {
                Maximum       = 100,
                Minimum       = 0,
                HeightRequest = 20,
            };

            paddingSlider.SetBinding(Slider.ValueProperty, "PUDPadding");
            paddingSlider.BindingContext = this;

            var pointerCornerRadiusSlider = new Slider
            {
                Maximum       = 20,
                Minimum       = 0,
                HeightRequest = 20,
            };

            pointerCornerRadiusSlider.SetBinding(Slider.ValueProperty, "PointerCornerRadius");
            pointerCornerRadiusSlider.BindingContext = this;

            var leftSeg = new Forms9Patch.Segment
            {
                Text       = "⬅︎",
                IsSelected = true,
            };

            leftSeg.Tapped += (sender, e) => _lastChanged = leftSeg.VisualElement;
            var upSeg = new Forms9Patch.Segment
            {
                Text = "⬆︎",
            };

            upSeg.Tapped += (sender, e) => _lastChanged = upSeg.VisualElement;
            var rightSeg = new Forms9Patch.Segment
            {
                Text = "➡︎",
            };

            rightSeg.Tapped += (sender, e) => _lastChanged = rightSeg.VisualElement;
            var downSeg = new Forms9Patch.Segment
            {
                Text = "⬇︎",
            };

            downSeg.Tapped += (sender, e) => _lastChanged = downSeg.VisualElement;

            PointerDirection = Forms9Patch.PointerDirection.Left;
            var directionSegmentControl = new Forms9Patch.MaterialSegmentedControl
            {
                Segments            = { leftSeg, upSeg, rightSeg, downSeg, },
                GroupToggleBehavior = Forms9Patch.GroupToggleBehavior.Multiselect,
            };

            directionSegmentControl.SegmentTapped += (sender, e) =>
            {
                var dir = Forms9Patch.PointerDirection.None;
                dir |= (leftSeg.IsSelected ? Forms9Patch.PointerDirection.Left : Forms9Patch.PointerDirection.None);
                dir |= (rightSeg.IsSelected ? Forms9Patch.PointerDirection.Right : Forms9Patch.PointerDirection.None);
                dir |= (upSeg.IsSelected ? Forms9Patch.PointerDirection.Up : Forms9Patch.PointerDirection.None);
                dir |= (downSeg.IsSelected ? Forms9Patch.PointerDirection.Down : Forms9Patch.PointerDirection.None);
                PointerDirection = dir;
                System.Diagnostics.Debug.WriteLine("Direction changed");
            };

            var bubbleLabel = new Label
            {
                Text      = "Forms9Patch.BubblePopup",
                TextColor = Color.Black,
                //BackgroundColor = Color.Green,
            };
            var bubbleButton = new Forms9Patch.MaterialButton
            {
                Text = "Close",
                //BackgroundColor = Color.Blue,
                OutlineColor = Color.Blue,
                FontColor    = Color.Blue,
            };

            //bubbleLabel.SetBinding (Label.TextProperty, "CornerRadius");
            bubbleLabel.BindingContext = this;

            var bubble = new Forms9Patch.BubblePopup(this)
            {
                //BackgroundColor = Color.Green,
                //OutlineColor = Color.Black,
                //OutlineWidth = 1,
                PointerCornerRadius = 0,
                Content             = new StackLayout
                {
                    Children =
                    {
                        //bubbleLabel,
                        new Label {
                            Text = "Pointer Length:", FontSize = 10,
                        },
                        pointerLengthSlider,
                        new Label {
                            Text = "Pointer Tip Radius:", FontSize = 10,
                        },
                        pointerTipRadiusSlider,
                        new Label {
                            Text = "Corner Radius:", FontSize = 10,
                        },
                        cornerRadiusSlider,
                        new Label {
                            Text = "Pointer Corner Radius:", FontSize = 10,
                        },
                        pointerCornerRadiusSlider,
                        bubbleButton,
                    }
                },
            };

            bubble.SetBinding(Forms9Patch.BubblePopup.OutlineRadiusProperty, "CornerRadius");
            bubble.SetBinding(Forms9Patch.BubblePopup.PointerLengthProperty, "PointerLength");
            bubble.SetBinding(Forms9Patch.BubblePopup.PointerTipRadiusProperty, "PointerTipRadius");
            bubble.SetBinding(Forms9Patch.BubblePopup.PaddingProperty, "Padding");
            bubble.SetBinding(Forms9Patch.BubblePopup.HasShadowProperty, "HasShadow");
            bubble.SetBinding(Forms9Patch.BubblePopup.ShadowInvertedProperty, "ShadowInverted");
            bubble.SetBinding(Forms9Patch.BubblePopup.PointerDirectionProperty, "PointerDirection");
            bubble.SetBinding(Forms9Patch.BubblePopup.PointerCornerRadiusProperty, "PointerCornerRadius");
            bubble.BindingContext = this;


            bubbleButton.Tapped += (sender, e) => bubble.IsVisible = false;
            bubble.Cancelled    += (sender, e) =>
            {
                var newbubble = new Forms9Patch.BubblePopup(this)
                {
                    //BackgroundColor = Color.Green,
                    //OutlineColor = Color.Black,
                    //OutlineWidth = 1,
                    Target = bubbleButton,
                    PointerCornerRadius = 0,
                    Content             = new StackLayout
                    {
                        Children =
                        {
                            //bubbleLabel,
                            new Label {
                                Text = "Pointer Length:", FontSize = 10,
                            },
                            pointerLengthSlider,
                            new Label {
                                Text = "Pointer Tip Radius:", FontSize = 10,
                            },
                            pointerTipRadiusSlider,
                            new Label {
                                Text = "Corner Radius:", FontSize = 10,
                            },
                            cornerRadiusSlider,
                            new Label {
                                Text = "Pointer Corner Radius:", FontSize = 10,
                            },
                            pointerCornerRadiusSlider,
                            bubbleButton,
                        }
                    },
                };

                newbubble.IsVisible = true;
            };

            var showButton = new Forms9Patch.MaterialButton
            {
                Text         = "Show BubblePopup",
                OutlineColor = Color.Blue,
                FontColor    = Color.Blue,
            };

            showButton.Tapped += (object sender, EventArgs e) =>
            {
                bubble.Target    = _lastChanged;
                bubble.IsVisible = true;
            };

            _lastChanged = leftSeg.VisualElement;

            Content = new StackLayout
            {
                Children =
                {
                    new StackLayout           {
                        Orientation = StackOrientation.Horizontal,
                        Children    =
                        {
                            new StackLayout   {
                                Children =
                                {
                                    new Label {
                                        Text = "Has Shadow", FontSize = 10,
                                    },
                                    shadowToggle,
                                },
                                HorizontalOptions = LayoutOptions.StartAndExpand,
                            },
                            new StackLayout   {
                                Children =
                                {
                                    new Label {
                                        Text = "Inset Shadow", FontSize = 10,
                                    },
                                    shadowInvertedToggle,
                                },
                                HorizontalOptions = LayoutOptions.EndAndExpand,
                            }
                        }
                    },
                    new Label                 {
                        Text = "Padding:", FontSize = 10,
                    },
                    paddingSlider,
                    new Label                 {
                        Text = "Pointer Direction", FontSize = 10,
                    },
                    directionSegmentControl,
                    showButton,
                    new Label                 {
                        Text = "Arrows choose the BubblePopup's allowed pointer direction.  Bubble's pointer will point at the last selected arrow-segment-button."
                    },
                }
            };
        }
コード例 #3
0
        public HtmlButtonsPage()
        {
            Padding         = 20;
            BackgroundColor = Color.White;

            #region Material Button
            var mb1 = new Forms9Patch.MaterialButton {
                HtmlText = "<i>Markup</i> button <font size=\"4\" face=\"Forms9PatchDemo.Resources.Fonts.MaterialIcons-Regular.ttf\"></font>",
                //Text = "Pizza",
                BackgroundColor = Color.FromRgb(200, 200, 200),
                FontColor       = Color.Blue,
                HasShadow       = true,
                ToggleBehavior  = true,
            };
            mb1.Tapped       += (sender, e) => System.Diagnostics.Debug.WriteLine("Tapped");
            mb1.Selected     += (sender, e) => System.Diagnostics.Debug.WriteLine("Selected");
            mb1.LongPressing += (sender, e) => System.Diagnostics.Debug.WriteLine("Long Pressing");
            mb1.LongPressed  += (sender, e) => System.Diagnostics.Debug.WriteLine("Long Pressed");
            #endregion

            #region Segmented Button
            var sc1 = new Forms9Patch.MaterialSegmentedControl {
                HasShadow       = true,
                BackgroundColor = Color.FromRgb(200, 200, 200),
                //FontColor = Color.Blue,
                Segments =
                {
                    new Forms9Patch.Segment {
                        HtmlText = "<font size=\"4\" face=\"Forms9PatchDemo.Resources.Fonts.MaterialIcons-Regular.ttf\"></font> Cart",
                    },
                    new Forms9Patch.Segment {
                        HtmlText = "<font size=\"4\" face=\"Forms9PatchDemo.Resources.Fonts.MaterialIcons-Regular.ttf\"></font> Pay",
                    },
                    new Forms9Patch.Segment {
                        HtmlText = "<font size=\"4\" face=\"Forms9PatchDemo.Resources.Fonts.MaterialIcons-Regular.ttf\"></font> Ship",
                    },
                    new Forms9Patch.Segment {
                        HtmlText = "<font size=\"4\" face=\"Forms9PatchDemo.Resources.Fonts.MaterialIcons-Regular.ttf\"></font> Email",
                    },
                },
            };
            sc1.SegmentSelected     += OnSegmentSelected;
            sc1.SegmentTapped       += OnSegmentTapped;
            sc1.SegmentLongPressing += OnSegmentLongPressing;
            sc1.SegmentLongPressed  += OnSegmentLongPressed;
            #endregion

            #region Image Button
            var ib1 = new Forms9Patch.ImageButton {
                DefaultState = new Forms9Patch.ImageButtonState {
                    BackgroundImage = new Forms9Patch.Image {
                        Source = Forms9Patch.ImageSource.FromMultiResource("Forms9PatchDemo.Resources.button"),
                    },
                    Image = new Image {
                        Source = ImageSource.FromFile("five.png"),
                    },
                    FontColor = Color.White,
                    //Text = "Sticky w/ SelectedState",
                    HtmlText = "<b>Sticky</b> with <i>SelectedState</i>",
                },
                SelectedState = new Forms9Patch.ImageButtonState {
                    BackgroundImage = new Forms9Patch.Image {
                        Source = Forms9Patch.ImageSource.FromMultiResource("Forms9PatchDemo.Resources.image"),
                    },
                    FontColor = Color.Red,
                    //Text = "Selected",
                    HtmlText = "<b><i>Selected</i></b>",
                },
                ToggleBehavior = true,
                HeightRequest  = 50,
                Alignment      = TextAlignment.Start,
            };
            ib1.Tapped       += OnImageButtonTapped;
            ib1.Selected     += OnImageButtonSelected;
            ib1.LongPressing += OnImageButtonLongPressing;
            ib1.LongPressed  += OnImageButtonLongPressed;
            #endregion

            Content = new StackLayout {
                Children =
                {
                    new Forms9Patch.Label {
                        HtmlText = "<b>HTML Buttons</b>"
                    },
                    mb1,
                    sc1,
                    ib1,
                }
            };
        }
コード例 #4
0
        public BubblePopupTestPage()
        {
            BackgroundColor = Color.White;
            Padding = new Thickness(20,Device.OnPlatform(20,0,0),20,20);

            var shadowToggle = new Switch ();
            shadowToggle.SetBinding (Switch.IsToggledProperty, "HasShadow");
            shadowToggle.BindingContext = this;

            var shadowInvertedToggle = new Switch ();
            shadowInvertedToggle.SetBinding (Switch.IsToggledProperty, "ShadowInverted");
            shadowInvertedToggle.BindingContext = this;

            var cornerRadiusSlider = new Slider {
                Maximum = 40,
                Minimum = 0,
                HeightRequest = 20,
            };
            cornerRadiusSlider.SetBinding (Slider.ValueProperty, "CornerRadius");
            cornerRadiusSlider.BindingContext = this;

            var pointerLengthSlider = new Slider {
                Maximum = 40,
                Minimum = 0,
                HeightRequest = 20,
            };
            pointerLengthSlider.SetBinding (Slider.ValueProperty, "PointerLength");
            pointerLengthSlider.BindingContext = this;

            var pointerTipRadiusSlider = new Slider {
                Maximum = 20,
                Minimum = 0,
                HeightRequest = 20,
            };
            pointerTipRadiusSlider.SetBinding (Slider.ValueProperty, "PointerTipRadius");
            pointerTipRadiusSlider.BindingContext = this;

            var paddingSlider = new Slider {
                Maximum = 100,
                Minimum = 0,
                HeightRequest = 20,
            };
            paddingSlider.SetBinding (Slider.ValueProperty, "PUDPadding");
            paddingSlider.BindingContext = this;

            var pointerCornerRadiusSlider = new Slider {
                Maximum = 20,
                Minimum = 0,
                HeightRequest = 20,
            };
            pointerCornerRadiusSlider.SetBinding (Slider.ValueProperty, "PointerCornerRadius");
            pointerCornerRadiusSlider.BindingContext = this;

            var leftSeg = new Forms9Patch.Segment {
                Text = "⬅︎",
                IsSelected = true,
            };
            leftSeg.Tapped += (sender, e) => _lastChanged = leftSeg.VisualElement;
            var upSeg = new Forms9Patch.Segment {
                Text = "⬆︎",
            };
            upSeg.Tapped += (sender, e) => _lastChanged = upSeg.VisualElement;
            var rightSeg = new Forms9Patch.Segment {
                Text = "➡︎",
            };
            rightSeg.Tapped += (sender, e) => _lastChanged = rightSeg.VisualElement;
            var downSeg = new Forms9Patch.Segment {
                Text = "⬇︎",
            };
            downSeg.Tapped += (sender, e) => _lastChanged = downSeg.VisualElement;

            PointerDirection = Forms9Patch.PointerDirection.Left;
            var directionSegmentControl = new Forms9Patch.MaterialSegmentedControl {
                Segments = { leftSeg, upSeg, rightSeg, downSeg, },
                GroupToggleBehavior = Forms9Patch.GroupToggleBehavior.Multiselect,
            };
            directionSegmentControl.SegmentTapped += (sender,e) => {
                var dir = Forms9Patch.PointerDirection.None;
                dir |= (leftSeg.IsSelected ? Forms9Patch.PointerDirection.Left : Forms9Patch.PointerDirection.None);
                dir |= (rightSeg.IsSelected ? Forms9Patch.PointerDirection.Right : Forms9Patch.PointerDirection.None);
                dir |= (upSeg.IsSelected ? Forms9Patch.PointerDirection.Up : Forms9Patch.PointerDirection.None);
                dir |= (downSeg.IsSelected ? Forms9Patch.PointerDirection.Down : Forms9Patch.PointerDirection.None);
                PointerDirection = dir;
                System.Diagnostics.Debug.WriteLine("Direction changed");
            };

            var bubbleLabel = new Label {
                Text = "Forms9Patch.BubblePopup",
                TextColor = Color.Black,
                //BackgroundColor = Color.Green,
            };
            var bubbleButton = new Forms9Patch.MaterialButton {
                Text = "Close",
                //BackgroundColor = Color.Blue,
                OutlineColor = Color.Blue,
                FontColor = Color.Blue,
            };
            //bubbleLabel.SetBinding (Label.TextProperty, "CornerRadius");
            bubbleLabel.BindingContext = this;

            var bubble = new Forms9Patch.BubblePopup {
                //BackgroundColor = Color.Green,
                //OutlineColor = Color.Black,
                //OutlineWidth = 1,
                PointerCornerRadius = 0,
                Content = new StackLayout {
                    Children = {
                        //bubbleLabel,
                        new Label { Text = "Pointer Length:", FontSize=10, },
                        pointerLengthSlider,
                        new Label { Text = "Pointer Tip Radius:", FontSize=10, },
                        pointerTipRadiusSlider,
                        new Label { Text = "Corner Radius:" , FontSize=10, },
                        cornerRadiusSlider,
                        new Label { Text = "Pointer Corner Radius:" , FontSize=10, },
                        pointerCornerRadiusSlider,
                        bubbleButton,
                    }
                },
            };
            bubble.SetBinding (Forms9Patch.BubblePopup.OutlineRadiusProperty, "CornerRadius");
            bubble.SetBinding (Forms9Patch.BubblePopup.PointerLengthProperty, "PointerLength");
            bubble.SetBinding (Forms9Patch.BubblePopup.PointerTipRadiusProperty, "PointerTipRadius");
            bubble.SetBinding (Forms9Patch.BubblePopup.PaddingProperty, "PUPadding");
            bubble.SetBinding (Forms9Patch.BubblePopup.HasShadowProperty, "HasShadow");
            bubble.SetBinding (Forms9Patch.BubblePopup.ShadowInvertedProperty, "ShadowInverted");
            bubble.SetBinding (Forms9Patch.BubblePopup.PointerDirectionProperty, "PointerDirection");
            bubble.SetBinding (Forms9Patch.BubblePopup.PointerCornerRadiusProperty, "PointerCornerRadius");
            bubble.BindingContext = this;

            bubbleButton.Tapped += (sender, e) => bubble.IsVisible = false;

            var showButton = new Forms9Patch.MaterialButton {
                Text = "Show BubblePopup",
                OutlineColor = Color.Blue,
                FontColor = Color.Blue,
            };
            showButton.Tapped += (object sender, EventArgs e) => {
                bubble.Target = _lastChanged;
                bubble.IsVisible = true;
            };

            _lastChanged = leftSeg.VisualElement;

            Content = new StackLayout {
                Children = {
                    new StackLayout {
                        Orientation = StackOrientation.Horizontal,
                        Children = {
                            new StackLayout {
                                Children = {
                                    new Label { Text = "Has Shadow", FontSize=10, },
                                    shadowToggle,
                                },
                                HorizontalOptions = LayoutOptions.StartAndExpand,
                            },
                            new StackLayout {
                                Children = {
                                    new Label { Text = "Inset Shadow", FontSize=10, },
                                    shadowInvertedToggle,
                                },
                                HorizontalOptions = LayoutOptions.EndAndExpand,
                            }
                        }
                    },
                    new Label { Text = "Padding:", FontSize=10, },
                    paddingSlider,
                    new Label { Text = "Pointer Direction", FontSize=10, },
                    directionSegmentControl,
                    showButton,
                    new Label { Text = "Arrows choose the BubblePopup's allowed pointer direction.  Bubble's pointer will point at the last selected arrow-segment-button." },
                }
            };
        }
コード例 #5
0
        public EllipticalMaterialButtonsPage()
        {
            var infoIcon =  Forms9Patch.ImageSource.FromMultiResource("Forms9PatchDemo.Resources.Info");
            var arrowIcon = Forms9Patch.ImageSource.FromMultiResource("Forms9PatchDemo.Resources.ArrowR");

            #region Material Buttons
            var grid = new Grid {
                RowDefinitions = {
                    new RowDefinition { Height = GridLength.Auto }
                },
                ColumnDefinitions = {
                    new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) },
                    new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }
                }
            };

            var mb1 = new Forms9Patch.MaterialButton {
                Text = "",
                ImageSource = arrowIcon,
                IsElliptical = true
            };
            mb1.Tapped += OnMaterialButtonTapped;
            mb1.Selected += OnMaterialButtonSelected;
            mb1.LongPressing += OnMaterialButtonLongPressing;
            mb1.LongPressed += OnMaterialButtonLongPressed;
            var mb2 = new Forms9Patch.MaterialButton {
                //Text = "toggle",
                ToggleBehavior = true,
                ImageSource = infoIcon,
                IsElliptical = true,

            };
            mb2.Tapped += OnMaterialButtonTapped;
            mb2.Selected += OnMaterialButtonSelected;
            mb2.LongPressing += OnMaterialButtonLongPressing;
            mb2.LongPressed += OnMaterialButtonLongPressed;
            var mb3 = new Forms9Patch.MaterialButton {
                //Text = "disabled",
                ToggleBehavior = true,
                IsEnabled = false,
                ImageSource = arrowIcon,
                IsElliptical = true
            };
            mb3.Tapped += OnMaterialButtonTapped;
            mb3.Selected += OnMaterialButtonSelected;
            mb3.LongPressing += OnMaterialButtonLongPressing;
            mb3.LongPressed += OnMaterialButtonLongPressed;
            var mb4 = new Forms9Patch.MaterialButton {
                //Text = "selected disabled",
                IsEnabled = false,
                IsSelected = true,
                ImageSource = infoIcon,
                IsElliptical = true
            };
            mb4.Tapped += OnMaterialButtonTapped;
            mb4.Selected += OnMaterialButtonSelected;
            mb4.LongPressing += OnMaterialButtonLongPressing;
            mb4.LongPressed += OnMaterialButtonLongPressed;

            var label1 = new Label {
                Text = "Gesture Label",
                BackgroundColor = Color.Blue,
                HeightRequest = 50
            };

            var label1Listener = new FormsGestures.Listener (label1);
            label1Listener.Tapped += (sender, e) => System.Diagnostics.Debug.WriteLine($"Tapped:{((Label)sender).Text}");
            label1Listener.DoubleTapped += (sender, e) => System.Diagnostics.Debug.WriteLine($"DoubleTapped:{((Label)sender).Text}");
            label1Listener.LongPressing += (sender, e) => System.Diagnostics.Debug.WriteLine($"LongPressing:{((Label)sender).Text}");
            // How to remove a listener!
            label1Listener.LongPressed += (sender, e) => {
                label1Listener.Dispose();
                System.Diagnostics.Debug.WriteLine("Removed FormsGestures.Listener");
            };

            grid.Children.Add (new StackLayout {
                BackgroundColor = Color.FromHex("#33FF33"),
                Padding = new Thickness(10),
                Children = {

                    new Label {
                        Text = "Default, Light",
                        TextColor = Color.Black
                    },
                    mb1,mb2, mb3, mb4,

                    new Label {
                        Text = "Outline, Light",
                        TextColor = Color.Black
                    },
                    new Forms9Patch.MaterialButton {
                        Text = "",
                        ImageSource = arrowIcon,
                        OutlineWidth = 0,
                        IsElliptical = true
                    },
                    new Forms9Patch.MaterialButton {
                        //Text = "toggle",
                        ToggleBehavior = true,
                        ImageSource = infoIcon,
                        OutlineWidth = 0,
                        IsElliptical = true
                    },
                    new Forms9Patch.MaterialButton {
                        //Text = "disabled",
                        ToggleBehavior = true,
                        IsEnabled = false,
                        ImageSource = arrowIcon,
                        OutlineWidth = 0,
                        IsElliptical = true
                    },
                    new Forms9Patch.MaterialButton {
                        //Text = "selected disabled",
                        IsEnabled = false,
                        IsSelected = true,
                        ImageSource = infoIcon,
                        OutlineWidth = 0,
                        IsElliptical = true
                    },

                    new Label {
                        Text = "Background Color, Light Theme",
                        TextColor = Color.Black
                    },
                    new Forms9Patch.MaterialButton {
                        Text = "default",
                        BackgroundColor = Color.FromHex("#E0E0E0"),
                        ImageSource = arrowIcon,
                        Orientation = StackOrientation.Vertical,
                        IsElliptical = true
                    },
                    new Forms9Patch.MaterialButton {
                        Text = "toggle",
                        ToggleBehavior = true,
                        BackgroundColor = Color.FromHex("#E0E0E0"),
                        ImageSource = infoIcon,
                        IsElliptical = true
                    },
                    new Forms9Patch.MaterialButton {
                        Text = "disabled",
                        ToggleBehavior = true,
                        IsEnabled = false,
                        BackgroundColor = Color.FromHex("#E0E0E0"),
                        ImageSource = arrowIcon,
                        IsElliptical = true
                    },
                    new Forms9Patch.MaterialButton {
                        Text = "selected disabled",
                        IsEnabled = false,
                        IsSelected = true,
                        BackgroundColor = Color.FromHex("#E0E0E0"),
                        ImageSource = infoIcon,
                        IsElliptical = true
                    },

                    new Label {
                        Text = "Shadow, Light Theme",
                        TextColor = Color.Black
                    },
                    new Forms9Patch.MaterialButton {
                        Text = "default",
                        HasShadow = true,
                        ImageSource = infoIcon,
                        IsElliptical = true
                    },
                    new Forms9Patch.MaterialButton {
                        Text = "toggle",
                        ToggleBehavior = true,
                        HasShadow = true,
                        ImageSource = arrowIcon,
                        IsElliptical = true
                    },
                    new Forms9Patch.MaterialButton {
                        Text = "disabled",
                        ToggleBehavior = true,
                        IsEnabled = false,
                        HasShadow = true,
                        ImageSource = infoIcon,
                        IsElliptical = true
                    },
                    new Forms9Patch.MaterialButton {
                        Text = "selected disabled",
                        IsEnabled = false,
                        IsSelected = true,
                        HasShadow = true,
                        ImageSource = arrowIcon,
                        IsElliptical = true
                    },

                    new Label {
                        Text = "Shadow Background Color, Light Theme",
                        TextColor = Color.Black
                    },
                    new Forms9Patch.MaterialButton {
                        Text = "default",
                        BackgroundColor = Color.FromHex("#E0E0E0"),
                        HasShadow = true,
                        ImageSource = infoIcon,
                        IsElliptical = true
                    },
                    new Forms9Patch.MaterialButton {
                        Text = "toggle",
                        ToggleBehavior = true,
                        BackgroundColor = Color.FromHex("#E0E0E0"),
                        HasShadow = true,
                        ImageSource = arrowIcon,
                        IsElliptical = true
                    },
                    new Forms9Patch.MaterialButton {
                        Text = "disabled",
                        ToggleBehavior = true,
                        IsEnabled = false,
                        BackgroundColor = Color.FromHex("#E0E0E0"),
                        HasShadow = true,
                        ImageSource = infoIcon,
                        IsElliptical = true
                    },
                    new Forms9Patch.MaterialButton {
                        Text = "selected disabled",
                        IsEnabled = false,
                        IsSelected = true,
                        BackgroundColor = Color.FromHex("#E0E0E0"),
                        HasShadow = true,
                        ImageSource = arrowIcon,
                        IsElliptical = true
                    },

                },
            }, 0, 0);

            grid.Children.Add(new StackLayout {
                Padding = new Thickness(10),
                BackgroundColor = Color.FromHex("#003"),
                Children = {
                    new Label {
                        Text = "Default, Dark Theme",
                        TextColor = Color.White
                    },
                    new Forms9Patch.MaterialButton {
                        Text = "default",
                        DarkTheme = true,
                        IsElliptical = true
                    },
                    new Forms9Patch.MaterialButton {
                        Text = "toggle",
                        ToggleBehavior = true,
                        DarkTheme = true,
                        IsElliptical = true
                    },
                    new Forms9Patch.MaterialButton {
                        Text = "disabled",
                        ToggleBehavior = true,
                        IsEnabled = false,
                        DarkTheme = true,
                        IsElliptical = true
                    },
                    new Forms9Patch.MaterialButton {
                        Text = "selected disabled",
                        IsEnabled = false,
                        IsSelected = true,
                        DarkTheme = true,
                        IsElliptical = true
                    },

                    new Label {
                        Text = "Outline, Dark Theme",
                        TextColor = Color.White
                    },
                    new Forms9Patch.MaterialButton {
                        Text = "default",
                        DarkTheme = true,
                        OutlineWidth = 0,
                        IsElliptical = true
                    },
                    new Forms9Patch.MaterialButton {
                        Text = "toggle",
                        ToggleBehavior = true,
                        DarkTheme = true,
                        OutlineWidth = 0,
                        IsElliptical = true
                    },
                    new Forms9Patch.MaterialButton {
                        Text = "disabled",
                        ToggleBehavior = true,
                        IsEnabled = false,
                        DarkTheme = true,
                        OutlineWidth = 0,
                        IsElliptical = true
                    },
                    new Forms9Patch.MaterialButton {
                        Text = "selected disabled",
                        IsEnabled = false,
                        IsSelected = true,
                        DarkTheme = true,
                        OutlineWidth = 0,
                        IsElliptical = true
                    },

                    new Label {
                        Text = "Background Color, Dark Theme",
                        TextColor = Color.White
                    },
                    new Forms9Patch.MaterialButton {
                        Text = "default",
                        BackgroundColor = Color.FromHex("#1194F6"),
                        DarkTheme = true,
                        ImageSource = arrowIcon,
                        Orientation = StackOrientation.Vertical,
                        IsElliptical = true
                    },
                    new Forms9Patch.MaterialButton {
                        Text = "toggle",
                        ToggleBehavior = true,
                        BackgroundColor = Color.FromHex("#1194F6"),
                        DarkTheme = true,
                        IsElliptical = true
                    },

                    new Forms9Patch.MaterialButton {
                        Text = "disabled",
                        ToggleBehavior = true,
                        IsEnabled = false,
                        BackgroundColor = Color.FromHex("#1194F6"),
                        DarkTheme = true,
                        IsElliptical = true
                    },

                    new Forms9Patch.MaterialButton {
                        Text = "selected disabled",
                        IsEnabled = false,
                        IsSelected = true,
                        BackgroundColor = Color.FromHex("#1194F6"),
                        DarkTheme = true,
                        IsElliptical = true
                    },
                    new Label {
                        Text = "Shadow, Dark Theme",
                        TextColor = Color.White
                    },
                    new Forms9Patch.MaterialButton {
                        Text = "default",
                        DarkTheme = true,
                        HasShadow = true,
                        IsElliptical = true
                    },
                    new Forms9Patch.MaterialButton {
                        Text = "toggle",
                        ToggleBehavior = true,
                        DarkTheme = true,
                        HasShadow = true,
                        IsElliptical = true
                    },
                    new Forms9Patch.MaterialButton {
                        Text = "disabled",
                        ToggleBehavior = true,
                        IsEnabled = false,
                        DarkTheme = true,
                        HasShadow = true,
                        IsElliptical = true
                    },
                    new Forms9Patch.MaterialButton {
                        Text = "selected disabled",
                        IsEnabled = false,
                        IsSelected = true,
                        DarkTheme = true,
                        HasShadow = true,
                        IsElliptical = true
                    },
                    new Label {
                        Text = "Shadow Background Color, Dark Theme",
                        TextColor = Color.White
                    },
                    new Forms9Patch.MaterialButton {
                        Text = "default",
                        BackgroundColor = Color.FromHex("#1194F6"),
                        DarkTheme = true,
                        HasShadow = true,
                        IsElliptical = true
                    },
                    new Forms9Patch.MaterialButton {
                        Text = "toggle",
                        ToggleBehavior = true,
                        BackgroundColor = Color.FromHex("#1194F6"),
                        DarkTheme = true,
                        HasShadow = true,
                        IsElliptical = true
                    },

                    new Forms9Patch.MaterialButton {
                        Text = "disabled",
                        ToggleBehavior = true,
                        IsEnabled = false,
                        BackgroundColor = Color.FromHex("#1194F6"),
                        DarkTheme = true,
                        HasShadow = true,
                        IsElliptical = true
                    },

                    new Forms9Patch.MaterialButton {
                        Text = "selected disabled",
                        IsEnabled = false,
                        IsSelected = true,
                        BackgroundColor = Color.FromHex("#1194F6"),
                        DarkTheme = true,
                        HasShadow = true,
                        IsElliptical = true
                    },
                },
            },1,0);
            #endregion

            Padding = 20;
            Content = new ScrollView {
                Content = new StackLayout{
                    Children = {
                        grid,
                    },
                },
            };
        }
コード例 #6
0
        public HtmlButtonsPage()
        {
            Padding = 20;
            BackgroundColor = Color.White;

            #region Material Button
            var mb1 = new Forms9Patch.MaterialButton {
                HtmlText = "<i>Markup</i> button <font size=\"4\" face=\"Forms9PatchDemo.Resources.Fonts.MaterialIcons-Regular.ttf\"></font>",
                //Text = "Pizza",
                BackgroundColor = Color.FromRgb(200,200,200),
                FontColor = Color.Blue,
                HasShadow = true,
                ToggleBehavior = true,
            };
            mb1.Tapped += (sender, e) => System.Diagnostics.Debug.WriteLine ("Tapped");
            mb1.Selected += (sender, e) => System.Diagnostics.Debug.WriteLine ("Selected");
            mb1.LongPressing += (sender, e) => System.Diagnostics.Debug.WriteLine ("Long Pressing");
            mb1.LongPressed += (sender, e) => System.Diagnostics.Debug.WriteLine ("Long Pressed");
            #endregion

            #region Segmented Button
            var sc1 = new Forms9Patch.MaterialSegmentedControl {
                HasShadow = true,
                BackgroundColor = Color.FromRgb(200,200,200),
                //FontColor = Color.Blue,
                Segments = {

                    new Forms9Patch.Segment {
                        HtmlText = "<font size=\"4\" face=\"Forms9PatchDemo.Resources.Fonts.MaterialIcons-Regular.ttf\"></font> Cart",
                    },
                    new Forms9Patch.Segment {
                        HtmlText = "<font size=\"4\" face=\"Forms9PatchDemo.Resources.Fonts.MaterialIcons-Regular.ttf\"></font> Pay",
                    },
                    new Forms9Patch.Segment {
                        HtmlText = "<font size=\"4\" face=\"Forms9PatchDemo.Resources.Fonts.MaterialIcons-Regular.ttf\"></font> Ship",
                    },
                    new Forms9Patch.Segment {
                        HtmlText = "<font size=\"4\" face=\"Forms9PatchDemo.Resources.Fonts.MaterialIcons-Regular.ttf\"></font> Email",
                    },
                },
            };
            sc1.SegmentSelected += OnSegmentSelected;
            sc1.SegmentTapped += OnSegmentTapped;
            sc1.SegmentLongPressing += OnSegmentLongPressing;
            sc1.SegmentLongPressed += OnSegmentLongPressed;
            #endregion

            #region Image Button
            var ib1 = new Forms9Patch.ImageButton {
                DefaultState = new Forms9Patch.ImageButtonState {
                    BackgroundImage = new Forms9Patch.Image {
                        Source = Forms9Patch.ImageSource.FromMultiResource ("Forms9PatchDemo.Resources.button"),
                    },
                    Image = new Image {
                        Source = ImageSource.FromFile("five.png"),
                    },
                    FontColor = Color.White,
                    //Text = "Sticky w/ SelectedState",
                    HtmlText = "<b>Sticky</b> with <i>SelectedState</i>",
                },
                SelectedState = new Forms9Patch.ImageButtonState {
                    BackgroundImage = new Forms9Patch.Image {
                        Source = Forms9Patch.ImageSource.FromMultiResource ("Forms9PatchDemo.Resources.image"),
                    },
                    FontColor = Color.Red,
                    //Text = "Selected",
                    HtmlText = "<b><i>Selected</i></b>",

                },
                ToggleBehavior = true,
                HeightRequest = 50,
                Alignment = TextAlignment.Start,
            };
            ib1.Tapped += OnImageButtonTapped;
            ib1.Selected += OnImageButtonSelected;
            ib1.LongPressing += OnImageButtonLongPressing;
            ib1.LongPressed += OnImageButtonLongPressed;
            #endregion

            Content = new StackLayout {
                Children = {
                    new Forms9Patch.Label { HtmlText = "<b>HTML Buttons</b>" },
                    mb1,
                    sc1,
                    ib1,
                }
            };
        }
コード例 #7
0
        public MaterialButtonsPage()
        {
            var infoIcon  = Forms9Patch.ImageSource.FromMultiResource("Forms9PatchDemo.Resources.Info");
            var arrowIcon = Forms9Patch.ImageSource.FromMultiResource("Forms9PatchDemo.Resources.ArrowR");

            #region Material Buttons
            var grid = new Grid {
                RowDefinitions =
                {
                    new RowDefinition {
                        Height = GridLength.Auto
                    },
                },
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                },
            };



            var mb1 = new Forms9Patch.MaterialButton {
                Text        = "",
                ImageSource = arrowIcon,
            };
            mb1.Tapped       += OnMaterialButtonTapped;
            mb1.Selected     += OnMaterialButtonSelected;
            mb1.LongPressing += OnMaterialButtonLongPressing;
            mb1.LongPressed  += OnMaterialButtonLongPressed;
            var mb2 = new Forms9Patch.MaterialButton {
                //Text = "toggle",
                ToggleBehavior = true,
                ImageSource    = infoIcon,
            };
            mb2.Tapped       += OnMaterialButtonTapped;
            mb2.Selected     += OnMaterialButtonSelected;
            mb2.LongPressing += OnMaterialButtonLongPressing;
            mb2.LongPressed  += OnMaterialButtonLongPressed;
            var mb3 = new Forms9Patch.MaterialButton {
                //Text = "disabled",
                ToggleBehavior = true,
                IsEnabled      = false,
                ImageSource    = arrowIcon,
            };
            mb3.Tapped       += OnMaterialButtonTapped;
            mb3.Selected     += OnMaterialButtonSelected;
            mb3.LongPressing += OnMaterialButtonLongPressing;
            mb3.LongPressed  += OnMaterialButtonLongPressed;
            var mb4 = new Forms9Patch.MaterialButton {
                //Text = "selected disabled",
                IsEnabled   = false,
                IsSelected  = true,
                ImageSource = infoIcon,
            };
            mb4.Tapped       += OnMaterialButtonTapped;
            mb4.Selected     += OnMaterialButtonSelected;
            mb4.LongPressing += OnMaterialButtonLongPressing;
            mb4.LongPressed  += OnMaterialButtonLongPressed;


            var label1 = new Label {
                Text            = "Gesture Label",
                BackgroundColor = Color.Blue,
                HeightRequest   = 50,
            };

            var label1Listener = FormsGestures.Listener.For(label1);
            label1Listener.Tapped       += (sender, e) => System.Diagnostics.Debug.WriteLine($"Tapped:{((Label)sender).Text}");
            label1Listener.DoubleTapped += (sender, e) => System.Diagnostics.Debug.WriteLine($"DoubleTapped:{((Label)sender).Text}");
            label1Listener.LongPressing += (sender, e) => System.Diagnostics.Debug.WriteLine($"LongPressing:{((Label)sender).Text}");
            // How to remove a listener!
            label1Listener.LongPressed += (sender, e) => {
                label1Listener.Dispose();
                System.Diagnostics.Debug.WriteLine("Removed FormsGestures.Listener");
            };


            grid.Children.Add(new StackLayout {
                BackgroundColor = Color.FromHex("#33FF33"),
                Padding         = new Thickness(10),
                Children        =
                {
                    new Label                      {
                        Text      = "Default, Light",
                        TextColor = Color.Black,
                    },
                    mb1, mb2, mb3, mb4,

                    new Label                      {
                        Text      = "Outline, Light",
                        TextColor = Color.Black,
                    },
                    new Forms9Patch.MaterialButton {
                        Text         = "",
                        ImageSource  = arrowIcon,
                        OutlineWidth = 0,
                    },
                    new Forms9Patch.MaterialButton {
                        //Text = "toggle",
                        ToggleBehavior = true,
                        ImageSource    = infoIcon,
                        OutlineWidth   = 0,
                    },
                    new Forms9Patch.MaterialButton {
                        //Text = "disabled",
                        ToggleBehavior = true,
                        IsEnabled      = false,
                        ImageSource    = arrowIcon,
                        OutlineWidth   = 0,
                    },
                    new Forms9Patch.MaterialButton {
                        //Text = "selected disabled",
                        IsEnabled    = false,
                        IsSelected   = true,
                        ImageSource  = infoIcon,
                        OutlineWidth = 0,
                    },

                    new Label                      {
                        Text      = "Background Color, Light Theme",
                        TextColor = Color.Black,
                    },
                    new Forms9Patch.MaterialButton {
                        Text            = "default",
                        BackgroundColor = Color.FromHex("#E0E0E0"),
                        ImageSource     = arrowIcon,
                        Orientation     = StackOrientation.Vertical,
                    },
                    new Forms9Patch.MaterialButton {
                        Text            = "toggle",
                        ToggleBehavior  = true,
                        BackgroundColor = Color.FromHex("#E0E0E0"),
                        ImageSource     = infoIcon,
                    },
                    new Forms9Patch.MaterialButton {
                        Text            = "disabled",
                        ToggleBehavior  = true,
                        IsEnabled       = false,
                        BackgroundColor = Color.FromHex("#E0E0E0"),
                        ImageSource     = arrowIcon,
                    },
                    new Forms9Patch.MaterialButton {
                        Text            = "selected disabled",
                        IsEnabled       = false,
                        IsSelected      = true,
                        BackgroundColor = Color.FromHex("#E0E0E0"),
                        ImageSource     = infoIcon,
                    },

                    new Label                      {
                        Text      = "Shadow, Light Theme",
                        TextColor = Color.Black,
                    },
                    new Forms9Patch.MaterialButton {
                        Text        = "default",
                        HasShadow   = true,
                        ImageSource = infoIcon,
                    },
                    new Forms9Patch.MaterialButton {
                        Text           = "toggle",
                        ToggleBehavior = true,
                        HasShadow      = true,
                        ImageSource    = arrowIcon,
                    },
                    new Forms9Patch.MaterialButton {
                        Text           = "disabled",
                        ToggleBehavior = true,
                        IsEnabled      = false,
                        HasShadow      = true,
                        ImageSource    = infoIcon,
                    },
                    new Forms9Patch.MaterialButton {
                        Text        = "selected disabled",
                        IsEnabled   = false,
                        IsSelected  = true,
                        HasShadow   = true,
                        ImageSource = arrowIcon,
                    },

                    new Label                      {
                        Text      = "Shadow Background Color, Light Theme",
                        TextColor = Color.Black,
                    },
                    new Forms9Patch.MaterialButton {
                        Text            = "default",
                        BackgroundColor = Color.FromHex("#E0E0E0"),
                        HasShadow       = true,
                        ImageSource     = infoIcon,
                    },
                    new Forms9Patch.MaterialButton {
                        Text            = "toggle",
                        ToggleBehavior  = true,
                        BackgroundColor = Color.FromHex("#E0E0E0"),
                        HasShadow       = true,
                        ImageSource     = arrowIcon,
                    },
                    new Forms9Patch.MaterialButton {
                        Text            = "disabled",
                        ToggleBehavior  = true,
                        IsEnabled       = false,
                        BackgroundColor = Color.FromHex("#E0E0E0"),
                        HasShadow       = true,
                        ImageSource     = infoIcon,
                    },
                    new Forms9Patch.MaterialButton {
                        Text            = "selected disabled",
                        IsEnabled       = false,
                        IsSelected      = true,
                        BackgroundColor = Color.FromHex("#E0E0E0"),
                        HasShadow       = true,
                        ImageSource     = arrowIcon,
                    },
                },
            }, 0, 0);


            grid.Children.Add(new StackLayout {
                Padding         = new Thickness(10),
                BackgroundColor = Color.FromHex("#003"),
                Children        =
                {
                    new Label                      {
                        Text      = "Default, Dark Theme",
                        TextColor = Color.White,
                    },
                    new Forms9Patch.MaterialButton {
                        Text      = "default",
                        DarkTheme = true,
                    },
                    new Forms9Patch.MaterialButton {
                        Text           = "toggle",
                        ToggleBehavior = true,
                        DarkTheme      = true,
                    },
                    new Forms9Patch.MaterialButton {
                        Text           = "disabled",
                        ToggleBehavior = true,
                        IsEnabled      = false,
                        DarkTheme      = true,
                    },
                    new Forms9Patch.MaterialButton {
                        Text       = "selected disabled",
                        IsEnabled  = false,
                        IsSelected = true,
                        DarkTheme  = true,
                    },

                    new Label                      {
                        Text      = "Outline, Dark Theme",
                        TextColor = Color.White,
                    },
                    new Forms9Patch.MaterialButton {
                        Text         = "default",
                        DarkTheme    = true,
                        OutlineWidth = 0,
                    },
                    new Forms9Patch.MaterialButton {
                        Text           = "toggle",
                        ToggleBehavior = true,
                        DarkTheme      = true,
                        OutlineWidth   = 0,
                    },
                    new Forms9Patch.MaterialButton {
                        Text           = "disabled",
                        ToggleBehavior = true,
                        IsEnabled      = false,
                        DarkTheme      = true,
                        OutlineWidth   = 0,
                    },
                    new Forms9Patch.MaterialButton {
                        Text         = "selected disabled",
                        IsEnabled    = false,
                        IsSelected   = true,
                        DarkTheme    = true,
                        OutlineWidth = 0,
                    },

                    new Label                      {
                        Text      = "Background Color, Dark Theme",
                        TextColor = Color.White,
                    },
                    new Forms9Patch.MaterialButton {
                        Text            = "default",
                        BackgroundColor = Color.FromHex("#1194F6"),
                        DarkTheme       = true,
                        ImageSource     = arrowIcon,
                        Orientation     = StackOrientation.Vertical,
                    },
                    new Forms9Patch.MaterialButton {
                        Text            = "toggle",
                        ToggleBehavior  = true,
                        BackgroundColor = Color.FromHex("#1194F6"),
                        DarkTheme       = true,
                    },

                    new Forms9Patch.MaterialButton {
                        Text            = "disabled",
                        ToggleBehavior  = true,
                        IsEnabled       = false,
                        BackgroundColor = Color.FromHex("#1194F6"),
                        DarkTheme       = true,
                    },

                    new Forms9Patch.MaterialButton {
                        Text            = "selected disabled",
                        IsEnabled       = false,
                        IsSelected      = true,
                        BackgroundColor = Color.FromHex("#1194F6"),
                        DarkTheme       = true,
                    },
                    new Label                      {
                        Text      = "Shadow, Dark Theme",
                        TextColor = Color.White,
                    },
                    new Forms9Patch.MaterialButton {
                        Text      = "default",
                        DarkTheme = true,
                        HasShadow = true,
                    },
                    new Forms9Patch.MaterialButton {
                        Text           = "toggle",
                        ToggleBehavior = true,
                        DarkTheme      = true,
                        HasShadow      = true,
                    },
                    new Forms9Patch.MaterialButton {
                        Text           = "disabled",
                        ToggleBehavior = true,
                        IsEnabled      = false,
                        DarkTheme      = true,
                        HasShadow      = true,
                    },
                    new Forms9Patch.MaterialButton {
                        Text       = "selected disabled",
                        IsEnabled  = false,
                        IsSelected = true,
                        DarkTheme  = true,
                        HasShadow  = true,
                    },
                    new Label                      {
                        Text      = "Shadow Background Color, Dark Theme",
                        TextColor = Color.White,
                    },
                    new Forms9Patch.MaterialButton {
                        Text            = "default",
                        BackgroundColor = Color.FromHex("#1194F6"),
                        DarkTheme       = true,
                        HasShadow       = true,
                    },
                    new Forms9Patch.MaterialButton {
                        Text            = "toggle",
                        ToggleBehavior  = true,
                        BackgroundColor = Color.FromHex("#1194F6"),
                        DarkTheme       = true,
                        HasShadow       = true,
                    },

                    new Forms9Patch.MaterialButton {
                        Text            = "disabled",
                        ToggleBehavior  = true,
                        IsEnabled       = false,
                        BackgroundColor = Color.FromHex("#1194F6"),
                        DarkTheme       = true,
                        HasShadow       = true,
                    },

                    new Forms9Patch.MaterialButton {
                        Text            = "selected disabled",
                        IsEnabled       = false,
                        IsSelected      = true,
                        BackgroundColor = Color.FromHex("#1194F6"),
                        DarkTheme       = true,
                        HasShadow       = true,
                    },
                },
            }, 1, 0);
            #endregion


            #region Light SegmentedControl

            var sc1 = new Forms9Patch.MaterialSegmentedControl {
                Segments =
                {
                    new Forms9Patch.Segment {
                        Text             = "A",
                        ImageSource      = arrowIcon,
                        Command          = _trueCommand,
                        CommandParameter = "sc1 A",
                    },
                    new Forms9Patch.Segment {
                        //Text = "B",
                        IsSelected       = true,
                        ImageSource      = arrowIcon,
                        Command          = _trueCommand,
                        CommandParameter = "sc1 B",
                    },
                    new Forms9Patch.Segment {
                        Text             = "C",
                        Command          = _trueCommand,
                        CommandParameter = "sc1 C",
                    },

                    new Forms9Patch.Segment {
                        Text = "D",
                        //IsEnabled = false,
                        Command          = _falseCommand,
                        CommandParameter = "sc1 D",
                    },
                },
            };
            sc1.SegmentSelected     += OnSegmentSelected;
            sc1.SegmentTapped       += OnSegmentTapped;
            sc1.SegmentLongPressing += OnSegmentLongPressing;
            sc1.SegmentLongPressed  += OnSegmentLongPressed;

            var seg1 = new Forms9Patch.Segment {
                //Text = "A",
                ImageSource = arrowIcon,
            };
            seg1.Tapped       += OnMaterialButtonTapped;
            seg1.Selected     += OnMaterialButtonTapped;
            seg1.LongPressing += OnMaterialButtonLongPressing;
            seg1.LongPressed  += OnMaterialButtonLongPressed;
            var seg2 = new Forms9Patch.Segment {
                Text       = "B",
                IsSelected = true,
            };
            seg2.Tapped       += OnMaterialButtonTapped;
            seg2.Selected     += OnMaterialButtonTapped;
            seg2.LongPressing += OnMaterialButtonLongPressing;
            seg2.LongPressed  += OnMaterialButtonLongPressed;
            var seg3 = new Forms9Patch.Segment {
                Text = "C",
            };
            seg3.Tapped       += OnMaterialButtonTapped;
            seg3.Selected     += OnMaterialButtonTapped;
            seg3.LongPressing += OnMaterialButtonLongPressing;
            seg3.LongPressed  += OnMaterialButtonLongPressed;
            var seg4 = new Forms9Patch.Segment {
                Text      = "D",
                IsEnabled = false,
            };
            seg4.Tapped       += OnMaterialButtonTapped;
            seg4.Selected     += OnMaterialButtonTapped;
            seg4.LongPressing += OnMaterialButtonLongPressing;
            seg4.LongPressed  += OnMaterialButtonLongPressed;


            var sc2 = new Forms9Patch.MaterialSegmentedControl {
                OutlineWidth = 0,
                Segments     =
                {
                    seg1, seg2, seg3, seg4,
                },
            };
            sc2.SegmentSelected     += OnSegmentSelected;
            sc2.SegmentTapped       += OnSegmentTapped;
            sc2.SegmentLongPressing += OnSegmentLongPressing;
            sc2.SegmentLongPressed  += OnSegmentLongPressed;

            var sc3 = new Forms9Patch.MaterialSegmentedControl {
                //OutlineColor = Color.Transparent,
                BackgroundColor = Color.FromHex("#E0E0E0"),
                Segments        =
                {
                    new Forms9Patch.Segment {
                        Text = "A",
                    },
                    new Forms9Patch.Segment {
                        Text       = "B",
                        IsSelected = true,
                    },
                    new Forms9Patch.Segment {
                        Text = "C",
                    },
                    new Forms9Patch.Segment {
                        //Text = "D",
                        IsEnabled   = false,
                        ImageSource = arrowIcon,
                    },
                },
            };
            sc3.SegmentSelected     += OnSegmentSelected;
            sc3.SegmentTapped       += OnSegmentTapped;
            sc3.SegmentLongPressing += OnSegmentLongPressing;
            sc3.SegmentLongPressed  += OnSegmentLongPressed;

            var sc4 = new Forms9Patch.MaterialSegmentedControl {
                BackgroundColor     = Color.FromHex("#E0E0E0"),
                OutlineWidth        = 0,
                SeparatorWidth      = 1,
                GroupToggleBehavior = Forms9Patch.GroupToggleBehavior.None,
                Segments            =
                {
                    new Forms9Patch.Segment {
                        Text        = "A",
                        ImageSource = arrowIcon,
                        Orientation = StackOrientation.Vertical,
                    },
                    new Forms9Patch.Segment {
                        Text        = "B",
                        IsSelected  = true,
                        ImageSource = infoIcon,
                        Orientation = StackOrientation.Vertical,
                    },

                    new Forms9Patch.Segment {
                        Text        = "C",
                        ImageSource = arrowIcon,
                    },
                    new Forms9Patch.Segment {
                        Text        = "D",
                        IsEnabled   = false,
                        ImageSource = infoIcon,
                        Orientation = StackOrientation.Vertical,
                    },
                },
            };
            sc4.SegmentSelected     += OnSegmentSelected;
            sc4.SegmentTapped       += OnSegmentTapped;
            sc4.SegmentLongPressing += OnSegmentLongPressing;
            sc4.SegmentLongPressed  += OnSegmentLongPressed;

            var sc5 = new Forms9Patch.MaterialSegmentedControl {
                BackgroundColor = Color.FromHex("#E0E0E0"),
                HasShadow       = true,
                //OutlineRadius = 0,
                //OutlineWidth = 0,
                Orientation         = StackOrientation.Vertical,
                GroupToggleBehavior = Forms9Patch.GroupToggleBehavior.Multiselect,
                Segments            =
                {
                    new Forms9Patch.Segment {
                        Text        = "A",
                        ImageSource = arrowIcon,
                    },

                    new Forms9Patch.Segment {
                        Text       = "B",
                        IsSelected = true,
                    },
                    new Forms9Patch.Segment {
                        Text = "C",
                    },
                    new Forms9Patch.Segment {
                        Text      = "D",
                        IsEnabled = false,
                    },
                },
            };
            sc5.SegmentSelected     += OnSegmentSelected;
            sc5.SegmentTapped       += OnSegmentTapped;
            sc5.SegmentLongPressing += OnSegmentLongPressing;
            sc5.SegmentLongPressed  += OnSegmentLongPressed;

            var sc6 = new Forms9Patch.MaterialSegmentedControl {
                BackgroundColor = Color.FromHex("#E0E0E0"),
                HasShadow       = true,
                //OutlineRadius = 0,
                OutlineWidth        = 0,
                SeparatorWidth      = 1,
                Orientation         = StackOrientation.Vertical,
                GroupToggleBehavior = Forms9Patch.GroupToggleBehavior.Multiselect,
                Segments            =
                {
                    new Forms9Patch.Segment {
                        Text = "A",
                    },

                    new Forms9Patch.Segment {
                        Text        = "B",
                        IsSelected  = true,
                        ImageSource = arrowIcon,
                        //Orientation = StackOrientation.Vertical,
                    },
                    new Forms9Patch.Segment {
                        Text = "C",
                    },
                    new Forms9Patch.Segment {
                        Text      = "D",
                        IsEnabled = false,
                    },
                },
            };
            sc6.SegmentSelected     += OnSegmentSelected;
            sc6.SegmentTapped       += OnSegmentTapped;
            sc6.SegmentLongPressing += OnSegmentLongPressing;
            sc6.SegmentLongPressed  += OnSegmentLongPressed;

            #endregion


            Padding = 20;
            Content = new ScrollView {
                Content = new StackLayout {
                    Children =
                    {
                        grid,

                        #region MaterialSegmentControl

                        //new StackLayout {
                        //	Orientation = StackOrientation.Horizontal,
                        //	Children = {

                        #region Light
                        new StackLayout {
                            BackgroundColor   = Color.Lime,
                            HorizontalOptions = LayoutOptions.FillAndExpand,
                            Padding           = new Thickness(10),
                            Children          =
                            {
                                new Label {
                                    Text      = "Default, Light",
                                    TextColor = Color.Black,
                                },

                                sc1,sc2,  sc3, sc4, sc5, sc6,
                            },
                        },
                        #endregion


                        #region Dark
                        new StackLayout {
                            BackgroundColor   = Color.FromHex("#003"),
                            HorizontalOptions = LayoutOptions.FillAndExpand,
                            Padding           = new Thickness(10),
                            Children          =
                            {
                                new Label                                {
                                    Text      = "Default, Dark",
                                    TextColor = Color.White,
                                },

                                new Forms9Patch.MaterialSegmentedControl {
                                    //OutlineColor = Color.Transparent,
                                    DarkTheme = true,
                                    Segments  =
                                    {
                                        new Forms9Patch.Segment          {
                                            Text = "A",
                                        },
                                        new Forms9Patch.Segment          {
                                            //Text = "B",
                                            IsSelected  = true,
                                            ImageSource = arrowIcon,
                                        },
                                        new Forms9Patch.Segment          {
                                            Text = "C",
                                        },

                                        new Forms9Patch.Segment          {
                                            Text      = "D",
                                            IsEnabled = false,
                                        },
                                    },
                                },

                                new Forms9Patch.MaterialSegmentedControl {
                                    DarkTheme    = true,
                                    OutlineWidth = 0,
                                    Segments     =
                                    {
                                        new Forms9Patch.Segment          {
                                            //Text = "A",
                                            ImageSource = arrowIcon,
                                        },
                                        new Forms9Patch.Segment          {
                                            Text       = "B",
                                            IsSelected = true,
                                        },
                                        new Forms9Patch.Segment          {
                                            Text = "C",
                                        },

                                        new Forms9Patch.Segment          {
                                            Text      = "D",
                                            IsEnabled = false,
                                        },
                                    },
                                },

                                new Forms9Patch.MaterialSegmentedControl {
                                    DarkTheme       = true,
                                    BackgroundColor = Color.FromHex("#1194F6"),
                                    Segments        =
                                    {
                                        new Forms9Patch.Segment          {
                                            Text = "A",
                                        },
                                        new Forms9Patch.Segment          {
                                            Text       = "B",
                                            IsSelected = true,
                                        },
                                        new Forms9Patch.Segment          {
                                            Text = "C",
                                        },
                                        new Forms9Patch.Segment          {
                                            //Text = "D",
                                            IsEnabled   = false,
                                            ImageSource = arrowIcon,
                                        },
                                    },
                                },

                                new Forms9Patch.MaterialSegmentedControl {
                                    DarkTheme       = true,
                                    BackgroundColor = Color.FromHex("#1194F6"),
                                    OutlineWidth    = 0,
                                    Segments        =
                                    {
                                        new Forms9Patch.Segment          {
                                            Text        = "A",
                                            ImageSource = arrowIcon,
                                            Orientation = StackOrientation.Vertical,
                                        },
                                        new Forms9Patch.Segment          {
                                            Text        = "B",
                                            IsSelected  = true,
                                            ImageSource = infoIcon,
                                            Orientation = StackOrientation.Vertical,
                                        },

                                        new Forms9Patch.Segment          {
                                            Text        = "C",
                                            ImageSource = arrowIcon,
                                        },
                                        new Forms9Patch.Segment          {
                                            Text        = "D",
                                            IsEnabled   = false,
                                            ImageSource = infoIcon,
                                            Orientation = StackOrientation.Vertical,
                                        },
                                    },
                                },

                                new Forms9Patch.MaterialSegmentedControl {
                                    DarkTheme       = true,
                                    BackgroundColor = Color.FromHex("#1194F6"),
                                    HasShadow       = true,
                                    //OutlineRadius = 0,
                                    //OutlineWidth = 0,
                                    Orientation         = StackOrientation.Vertical,
                                    GroupToggleBehavior = Forms9Patch.GroupToggleBehavior.Multiselect,
                                    Segments            =
                                    {
                                        new Forms9Patch.Segment          {
                                            Text        = "A",
                                            ImageSource = arrowIcon,
                                        },

                                        new Forms9Patch.Segment          {
                                            Text       = "B",
                                            IsSelected = true,
                                        },
                                        new Forms9Patch.Segment          {
                                            Text = "C",
                                        },
                                        new Forms9Patch.Segment          {
                                            Text      = "D",
                                            IsEnabled = false,
                                        },
                                    },
                                },

                                new Forms9Patch.MaterialSegmentedControl {
                                    DarkTheme       = true,
                                    BackgroundColor = Color.FromHex("#1194F6"),
                                    HasShadow       = true,
                                    //OutlineRadius = 0,
                                    OutlineWidth        = 0,
                                    SeparatorWidth      = 1,
                                    Orientation         = StackOrientation.Vertical,
                                    GroupToggleBehavior = Forms9Patch.GroupToggleBehavior.Multiselect,
                                    Segments            =
                                    {
                                        new Forms9Patch.Segment          {
                                            Text = "A",
                                        },

                                        new Forms9Patch.Segment          {
                                            Text        = "B",
                                            IsSelected  = true,
                                            ImageSource = arrowIcon,
                                        },
                                        new Forms9Patch.Segment          {
                                            Text = "C",
                                        },
                                        new Forms9Patch.Segment          {
                                            Text      = "D",
                                            IsEnabled = false,
                                        },
                                    },
                                },
                            },
                        },
                        #endregion

                        //	},
                        //},

                        #endregion
                    },
                },
            };
        }
コード例 #8
0
        public ModalPopupTestPage()
        {
            BackgroundColor = Color.White;
            Padding         = new Thickness(20, Device.OnPlatform(20, 0, 0), 20, 20);

            var shadowToggle = new Switch();

            shadowToggle.SetBinding(Switch.IsToggledProperty, "HasShadow");
            shadowToggle.BindingContext = this;

            var shadowInvertedToggle = new Switch();

            shadowInvertedToggle.SetBinding(Switch.IsToggledProperty, "ShadowInverted");
            shadowInvertedToggle.BindingContext = this;

            var cornerRadiusSlider = new Slider {
                Maximum       = 40,
                Minimum       = 0,
                HeightRequest = 20,
            };

            cornerRadiusSlider.SetBinding(Slider.ValueProperty, "CornerRadius");
            cornerRadiusSlider.BindingContext = this;

            var paddingSlider = new Slider {
                Maximum       = 100,
                Minimum       = 0,
                HeightRequest = 20,
            };

            paddingSlider.SetBinding(Slider.ValueProperty, "PUDPadding");
            paddingSlider.BindingContext = this;

            //var listener = new FormsOrientation.Listener ();

            var hidePopupButton = new Forms9Patch.MaterialButton {
                Text            = "DONE",
                BackgroundColor = Color.Blue,
                DarkTheme       = true,
            };
            var showPopupButton = new Forms9Patch.MaterialButton {
                Text              = "Show Modal popup",
                BackgroundColor   = Color.Blue,
                DarkTheme         = true,
                WidthRequest      = 150,
                HorizontalOptions = LayoutOptions.Center,
            };

            var modal = new Forms9Patch.ModalPopup {
                Content = new StackLayout {
                    Children =
                    {
                        new Label {
                            Text      = "Hello Modal popup!",
                            TextColor = Color.Black,
                        },
                        new Label {
                            Text = "Padding:", FontSize = 10,
                        },
                        paddingSlider,
                        new Label {
                            Text = "Corner Radius:", FontSize = 10,
                        },
                        cornerRadiusSlider,
                        hidePopupButton,
                    },
                    //BackgroundColor = Color.FromRgb(100,100,100),
                    //Padding = 20,
                },
                OutlineRadius   = 4,
                OutlineWidth    = 1,
                OutlineColor    = Color.Black,
                BackgroundColor = Color.Aqua,
                HasShadow       = true,
            };

            modal.SetBinding(Forms9Patch.ModalPopup.OutlineRadiusProperty, "CornerRadius");
            modal.SetBinding(Forms9Patch.ModalPopup.OutlineWidthProperty, "OutlineWidth");
            modal.SetBinding(Forms9Patch.ModalPopup.PaddingProperty, "PUPadding");
            modal.SetBinding(Forms9Patch.ModalPopup.HasShadowProperty, "HasShadow");
            modal.SetBinding(Forms9Patch.ModalPopup.ShadowInvertedProperty, "ShadowInverted");
            modal.BindingContext = this;


            showPopupButton.Tapped += (sender, e) => {
                modal.IsVisible = true;
            };
            hidePopupButton.Tapped += (sender, e) => {
                modal.IsVisible = false;
                System.Diagnostics.Debug.WriteLine("button " + showPopupButton.Text);
            };

            Detail = new ContentPage {
                BackgroundColor = Color.White,
                Title           = "PopupTestPage - Detail",
                Content         = new StackLayout {
                    Children =
                    {
                        new Label                 {
                            Text      = "Hello ContentPage",
                            TextColor = Color.Black,
                        },
                        new StackLayout           {
                            Orientation = StackOrientation.Horizontal,
                            Children    =
                            {
                                new StackLayout   {
                                    Children =
                                    {
                                        new Label {
                                            Text = "Has Shadow", FontSize = 10,
                                        },
                                        shadowToggle,
                                    },
                                    HorizontalOptions = LayoutOptions.StartAndExpand,
                                },
                                new StackLayout   {
                                    Children =
                                    {
                                        new Label {
                                            Text = "Inset Shadow", FontSize = 10,
                                        },
                                        shadowInvertedToggle,
                                    },
                                    HorizontalOptions = LayoutOptions.EndAndExpand,
                                }
                            }
                        },
                        showPopupButton,
                    },
                    Padding = 20,
                },
            };

            Master = new ContentPage {
                Title   = "PopupTestPage - Master",
                Content = new Label {
                    Text = "Master Page",
                },
                BackgroundColor = Color.Gray,
            };
        }
コード例 #9
0
        public MaterialButtonsPage()
        {
            var infoIcon =  Forms9Patch.ImageSource.FromMultiResource("Forms9PatchDemo.Resources.Info");
            var arrowIcon = Forms9Patch.ImageSource.FromMultiResource("Forms9PatchDemo.Resources.ArrowR");

            #region Material Buttons
            var grid = new Grid {
                RowDefinitions = {
                    new RowDefinition { Height = GridLength.Auto },
                },
                ColumnDefinitions = {
                    new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) },
                    new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) },
                },

            };

            var mb1 = new Forms9Patch.MaterialButton {
                Text = "",
                ImageSource = arrowIcon,
            };
            mb1.Tapped += OnMaterialButtonTapped;
            mb1.Selected += OnMaterialButtonSelected;
            mb1.LongPressing += OnMaterialButtonLongPressing;
            mb1.LongPressed += OnMaterialButtonLongPressed;
            var mb2 = new Forms9Patch.MaterialButton {
                //Text = "toggle",
                ToggleBehavior = true,
                ImageSource = infoIcon,
            };
            mb2.Tapped += OnMaterialButtonTapped;
            mb2.Selected += OnMaterialButtonSelected;
            mb2.LongPressing += OnMaterialButtonLongPressing;
            mb2.LongPressed += OnMaterialButtonLongPressed;
            var mb3 = new Forms9Patch.MaterialButton {
                //Text = "disabled",
                ToggleBehavior = true,
                IsEnabled = false,
                ImageSource = arrowIcon,
            };
            mb3.Tapped += OnMaterialButtonTapped;
            mb3.Selected += OnMaterialButtonSelected;
            mb3.LongPressing += OnMaterialButtonLongPressing;
            mb3.LongPressed += OnMaterialButtonLongPressed;
            var mb4 = new Forms9Patch.MaterialButton {
                //Text = "selected disabled",
                IsEnabled = false,
                IsSelected = true,
                ImageSource = infoIcon,
            };
            mb4.Tapped += OnMaterialButtonTapped;
            mb4.Selected += OnMaterialButtonSelected;
            mb4.LongPressing += OnMaterialButtonLongPressing;
            mb4.LongPressed += OnMaterialButtonLongPressed;

            var label1 = new Label {
                Text = "Gesture Label",
                BackgroundColor = Color.Blue,
                HeightRequest = 50,
            };

            var label1Listener = new FormsGestures.Listener (label1);
            label1Listener.Tapped += (sender, e) => System.Diagnostics.Debug.WriteLine($"Tapped:{((Label)sender).Text}");
            label1Listener.DoubleTapped += (sender, e) => System.Diagnostics.Debug.WriteLine($"DoubleTapped:{((Label)sender).Text}");
            label1Listener.LongPressing += (sender, e) => System.Diagnostics.Debug.WriteLine($"LongPressing:{((Label)sender).Text}");
            // How to remove a listener!
            label1Listener.LongPressed += (sender, e) => {
                label1Listener.Dispose();
                System.Diagnostics.Debug.WriteLine("Removed FormsGestures.Listener");
            };

            grid.Children.Add (new StackLayout {
                BackgroundColor = Color.FromHex("#33FF33"),
                Padding = new Thickness(10),
                Children = {

                    new Label {
                        Text = "Default, Light",
                        TextColor = Color.Black,
                    },
                    mb1,mb2, mb3, mb4,

                    new Label {
                        Text = "Outline, Light",
                        TextColor = Color.Black,
                    },
                    new Forms9Patch.MaterialButton {
                        Text = "",
                        ImageSource = arrowIcon,
                        OutlineWidth = 0,
                    },
                    new Forms9Patch.MaterialButton {
                        //Text = "toggle",
                        ToggleBehavior = true,
                        ImageSource = infoIcon,
                        OutlineWidth = 0,
                    },
                    new Forms9Patch.MaterialButton {
                        //Text = "disabled",
                        ToggleBehavior = true,
                        IsEnabled = false,
                        ImageSource = arrowIcon,
                        OutlineWidth = 0,
                    },
                    new Forms9Patch.MaterialButton {
                        //Text = "selected disabled",
                        IsEnabled = false,
                        IsSelected = true,
                        ImageSource = infoIcon,
                        OutlineWidth = 0,
                    },

                    new Label {
                        Text = "Background Color, Light Theme",
                        TextColor = Color.Black,
                    },
                    new Forms9Patch.MaterialButton {
                        Text = "default",
                        BackgroundColor = Color.FromHex("#E0E0E0"),
                        ImageSource = arrowIcon,
                        Orientation = StackOrientation.Vertical,
                    },
                    new Forms9Patch.MaterialButton {
                        Text = "toggle",
                        ToggleBehavior = true,
                        BackgroundColor = Color.FromHex("#E0E0E0"),
                        ImageSource = infoIcon,
                    },
                    new Forms9Patch.MaterialButton {
                        Text = "disabled",
                        ToggleBehavior = true,
                        IsEnabled = false,
                        BackgroundColor = Color.FromHex("#E0E0E0"),
                        ImageSource = arrowIcon,
                    },
                    new Forms9Patch.MaterialButton {
                        Text = "selected disabled",
                        IsEnabled = false,
                        IsSelected = true,
                        BackgroundColor = Color.FromHex("#E0E0E0"),
                        ImageSource = infoIcon,
                    },

                    new Label {
                        Text = "Shadow, Light Theme",
                        TextColor = Color.Black,
                    },
                    new Forms9Patch.MaterialButton {
                        Text = "default",
                        HasShadow = true,
                        ImageSource = infoIcon,
                    },
                    new Forms9Patch.MaterialButton {
                        Text = "toggle",
                        ToggleBehavior = true,
                        HasShadow = true,
                        ImageSource = arrowIcon,
                    },
                    new Forms9Patch.MaterialButton {
                        Text = "disabled",
                        ToggleBehavior = true,
                        IsEnabled = false,
                        HasShadow = true,
                        ImageSource = infoIcon,
                    },
                    new Forms9Patch.MaterialButton {
                        Text = "selected disabled",
                        IsEnabled = false,
                        IsSelected = true,
                        HasShadow = true,
                        ImageSource = arrowIcon,
                    },

                    new Label {
                        Text = "Shadow Background Color, Light Theme",
                        TextColor = Color.Black,
                    },
                    new Forms9Patch.MaterialButton {
                        Text = "default",
                        BackgroundColor = Color.FromHex("#E0E0E0"),
                        HasShadow = true,
                        ImageSource = infoIcon,
                    },
                    new Forms9Patch.MaterialButton {
                        Text = "toggle",
                        ToggleBehavior = true,
                        BackgroundColor = Color.FromHex("#E0E0E0"),
                        HasShadow = true,
                        ImageSource = arrowIcon,
                    },
                    new Forms9Patch.MaterialButton {
                        Text = "disabled",
                        ToggleBehavior = true,
                        IsEnabled = false,
                        BackgroundColor = Color.FromHex("#E0E0E0"),
                        HasShadow = true,
                        ImageSource = infoIcon,
                    },
                    new Forms9Patch.MaterialButton {
                        Text = "selected disabled",
                        IsEnabled = false,
                        IsSelected = true,
                        BackgroundColor = Color.FromHex("#E0E0E0"),
                        HasShadow = true,
                        ImageSource = arrowIcon,
                    },

                },
            }, 0, 0);

            grid.Children.Add(new StackLayout {
                Padding = new Thickness(10),
                BackgroundColor = Color.FromHex("#003"),
                Children = {
                    new Label {
                        Text = "Default, Dark Theme",
                        TextColor = Color.White,
                    },
                    new Forms9Patch.MaterialButton {
                        Text = "default",
                        DarkTheme = true,
                    },
                    new Forms9Patch.MaterialButton {
                        Text = "toggle",
                        ToggleBehavior = true,
                        DarkTheme = true,
                    },
                    new Forms9Patch.MaterialButton {
                        Text = "disabled",
                        ToggleBehavior = true,
                        IsEnabled = false,
                        DarkTheme = true,
                    },
                    new Forms9Patch.MaterialButton {
                        Text = "selected disabled",
                        IsEnabled = false,
                        IsSelected = true,
                        DarkTheme = true,
                    },

                    new Label {
                        Text = "Outline, Dark Theme",
                        TextColor = Color.White,
                    },
                    new Forms9Patch.MaterialButton {
                        Text = "default",
                        DarkTheme = true,
                        OutlineWidth = 0,
                    },
                    new Forms9Patch.MaterialButton {
                        Text = "toggle",
                        ToggleBehavior = true,
                        DarkTheme = true,
                        OutlineWidth = 0,
                    },
                    new Forms9Patch.MaterialButton {
                        Text = "disabled",
                        ToggleBehavior = true,
                        IsEnabled = false,
                        DarkTheme = true,
                        OutlineWidth = 0,
                    },
                    new Forms9Patch.MaterialButton {
                        Text = "selected disabled",
                        IsEnabled = false,
                        IsSelected = true,
                        DarkTheme = true,
                        OutlineWidth = 0,
                    },

                    new Label {
                        Text = "Background Color, Dark Theme",
                        TextColor = Color.White,
                    },
                    new Forms9Patch.MaterialButton {
                        Text = "default",
                        BackgroundColor = Color.FromHex("#1194F6"),
                        DarkTheme = true,
                        ImageSource = arrowIcon,
                        Orientation = StackOrientation.Vertical,
                    },
                    new Forms9Patch.MaterialButton {
                        Text = "toggle",
                        ToggleBehavior = true,
                        BackgroundColor = Color.FromHex("#1194F6"),
                        DarkTheme = true,
                    },

                    new Forms9Patch.MaterialButton {
                        Text = "disabled",
                        ToggleBehavior = true,
                        IsEnabled = false,
                        BackgroundColor = Color.FromHex("#1194F6"),
                        DarkTheme = true,
                    },

                    new Forms9Patch.MaterialButton {
                        Text = "selected disabled",
                        IsEnabled = false,
                        IsSelected = true,
                        BackgroundColor = Color.FromHex("#1194F6"),
                        DarkTheme = true,
                    },
                    new Label {
                        Text = "Shadow, Dark Theme",
                        TextColor = Color.White,
                    },
                    new Forms9Patch.MaterialButton {
                        Text = "default",
                        DarkTheme = true,
                        HasShadow = true,
                    },
                    new Forms9Patch.MaterialButton {
                        Text = "toggle",
                        ToggleBehavior = true,
                        DarkTheme = true,
                        HasShadow = true,
                    },
                    new Forms9Patch.MaterialButton {
                        Text = "disabled",
                        ToggleBehavior = true,
                        IsEnabled = false,
                        DarkTheme = true,
                        HasShadow = true,
                    },
                    new Forms9Patch.MaterialButton {
                        Text = "selected disabled",
                        IsEnabled = false,
                        IsSelected = true,
                        DarkTheme = true,
                        HasShadow = true,
                    },
                    new Label {
                        Text = "Shadow Background Color, Dark Theme",
                        TextColor = Color.White,
                    },
                    new Forms9Patch.MaterialButton {
                        Text = "default",
                        BackgroundColor = Color.FromHex("#1194F6"),
                        DarkTheme = true,
                        HasShadow = true,
                    },
                    new Forms9Patch.MaterialButton {
                        Text = "toggle",
                        ToggleBehavior = true,
                        BackgroundColor = Color.FromHex("#1194F6"),
                        DarkTheme = true,
                        HasShadow = true,
                    },

                    new Forms9Patch.MaterialButton {
                        Text = "disabled",
                        ToggleBehavior = true,
                        IsEnabled = false,
                        BackgroundColor = Color.FromHex("#1194F6"),
                        DarkTheme = true,
                        HasShadow = true,
                    },

                    new Forms9Patch.MaterialButton {
                        Text = "selected disabled",
                        IsEnabled = false,
                        IsSelected = true,
                        BackgroundColor = Color.FromHex("#1194F6"),
                        DarkTheme = true,
                        HasShadow = true,
                    },
                },
            },1,0);
            #endregion

            #region Light SegmentedControl

            var sc1 = new Forms9Patch.MaterialSegmentedControl {
                Segments = {

                    new Forms9Patch.Segment {
                        Text = "A",
                        ImageSource = arrowIcon,
                        Command = _trueCommand,
                        CommandParameter = "sc1 A",
                    },
                    new Forms9Patch.Segment {
                        //Text = "B",
                        IsSelected = true,
                        ImageSource = arrowIcon,
                        Command = _trueCommand,
                        CommandParameter = "sc1 B",
                    },
                    new Forms9Patch.Segment {
                        Text = "C",
                        Command = _trueCommand,
                        CommandParameter = "sc1 C",
                    },

                    new Forms9Patch.Segment {
                        Text = "D",
                        //IsEnabled = false,
                        Command = _falseCommand,
                        CommandParameter = "sc1 D",
                    },
                },
            };
            sc1.SegmentSelected += OnSegmentSelected;
            sc1.SegmentTapped += OnSegmentTapped;
            sc1.SegmentLongPressing += OnSegmentLongPressing;
            sc1.SegmentLongPressed += OnSegmentLongPressed;

            var seg1 = new Forms9Patch.Segment {
                //Text = "A",
                ImageSource = arrowIcon,
            };
            seg1.Tapped += OnMaterialButtonTapped;
            seg1.Selected += OnMaterialButtonTapped;
            seg1.LongPressing += OnMaterialButtonLongPressing;
            seg1.LongPressed += OnMaterialButtonLongPressed;
            var seg2 = new Forms9Patch.Segment {
                Text = "B",
                IsSelected = true,
            };
            seg2.Tapped += OnMaterialButtonTapped;
            seg2.Selected += OnMaterialButtonTapped;
            seg2.LongPressing += OnMaterialButtonLongPressing;
            seg2.LongPressed += OnMaterialButtonLongPressed;
            var seg3 = new Forms9Patch.Segment {
                Text = "C",
            };
            seg3.Tapped += OnMaterialButtonTapped;
            seg3.Selected += OnMaterialButtonTapped;
            seg3.LongPressing += OnMaterialButtonLongPressing;
            seg3.LongPressed += OnMaterialButtonLongPressed;
            var seg4 = new Forms9Patch.Segment {
                Text = "D",
                IsEnabled = false,
            };
            seg4.Tapped += OnMaterialButtonTapped;
            seg4.Selected += OnMaterialButtonTapped;
            seg4.LongPressing += OnMaterialButtonLongPressing;
            seg4.LongPressed += OnMaterialButtonLongPressed;

            var sc2 = new Forms9Patch.MaterialSegmentedControl {
                OutlineWidth = 0,
                Segments = {
                    seg1, seg2, seg3, seg4,
                },
            };
            sc2.SegmentSelected += OnSegmentSelected;
            sc2.SegmentTapped += OnSegmentTapped;
            sc2.SegmentLongPressing += OnSegmentLongPressing;
            sc2.SegmentLongPressed += OnSegmentLongPressed;

            var sc3 = new Forms9Patch.MaterialSegmentedControl {
                //OutlineColor = Color.Transparent,
                BackgroundColor = Color.FromHex("#E0E0E0"),
                Segments = {
                    new Forms9Patch.Segment {
                        Text = "A",
                    },
                    new Forms9Patch.Segment {
                        Text = "B",
                        IsSelected = true,
                    },
                    new Forms9Patch.Segment {
                        Text = "C",
                    },
                    new Forms9Patch.Segment {
                        //Text = "D",
                        IsEnabled = false,
                        ImageSource = arrowIcon,
                    },
                },
            };
            sc3.SegmentSelected += OnSegmentSelected;
            sc3.SegmentTapped += OnSegmentTapped;
            sc3.SegmentLongPressing += OnSegmentLongPressing;
            sc3.SegmentLongPressed += OnSegmentLongPressed;

            var sc4 = new Forms9Patch.MaterialSegmentedControl {
                BackgroundColor = Color.FromHex("#E0E0E0"),
                OutlineWidth = 0,
                SeparatorWidth = 1,
                GroupToggleBehavior = Forms9Patch.GroupToggleBehavior.None,
                Segments = {
                    new Forms9Patch.Segment {
                        Text = "A",
                        ImageSource = arrowIcon,
                        Orientation = StackOrientation.Vertical,
                    },
                    new Forms9Patch.Segment {
                        Text = "B",
                        IsSelected = true,
                        ImageSource = infoIcon,
                        Orientation = StackOrientation.Vertical,
                    },

                    new Forms9Patch.Segment {
                        Text = "C",
                        ImageSource = arrowIcon,
                    },
                    new Forms9Patch.Segment {
                        Text = "D",
                        IsEnabled = false,
                        ImageSource = infoIcon,
                        Orientation = StackOrientation.Vertical,
                    },

                },
            };
            sc4.SegmentSelected += OnSegmentSelected;
            sc4.SegmentTapped += OnSegmentTapped;
            sc4.SegmentLongPressing += OnSegmentLongPressing;
            sc4.SegmentLongPressed += OnSegmentLongPressed;

            var sc5 = new Forms9Patch.MaterialSegmentedControl {
                BackgroundColor = Color.FromHex("#E0E0E0"),
                HasShadow = true,
                //OutlineRadius = 0,
                //OutlineWidth = 0,
                Orientation = StackOrientation.Vertical,
                GroupToggleBehavior = Forms9Patch.GroupToggleBehavior.Multiselect,
                Segments = {

                    new Forms9Patch.Segment {
                        Text = "A",
                        ImageSource = arrowIcon,
                    },

                    new Forms9Patch.Segment {
                        Text = "B",
                        IsSelected = true,
                    },
                    new Forms9Patch.Segment {
                        Text = "C",
                    },
                    new Forms9Patch.Segment {
                        Text = "D",
                        IsEnabled = false,
                    },

                },
            };
            sc5.SegmentSelected += OnSegmentSelected;
            sc5.SegmentTapped += OnSegmentTapped;
            sc5.SegmentLongPressing += OnSegmentLongPressing;
            sc5.SegmentLongPressed += OnSegmentLongPressed;

            var sc6 = new Forms9Patch.MaterialSegmentedControl {
                BackgroundColor = Color.FromHex("#E0E0E0"),
                HasShadow = true,
                //OutlineRadius = 0,
                OutlineWidth = 0,
                SeparatorWidth = 1,
                Orientation = StackOrientation.Vertical,
                GroupToggleBehavior = Forms9Patch.GroupToggleBehavior.Multiselect,
                Segments = {

                    new Forms9Patch.Segment {
                        Text = "A",
                    },

                    new Forms9Patch.Segment {
                        Text = "B",
                        IsSelected = true,
                        ImageSource = arrowIcon,
                        //Orientation = StackOrientation.Vertical,
                    },
                    new Forms9Patch.Segment {
                        Text = "C",
                    },
                    new Forms9Patch.Segment {
                        Text = "D",
                        IsEnabled = false,
                    },

                },
            };
            sc6.SegmentSelected += OnSegmentSelected;
            sc6.SegmentTapped += OnSegmentTapped;
            sc6.SegmentLongPressing += OnSegmentLongPressing;
            sc6.SegmentLongPressed += OnSegmentLongPressed;

            #endregion

            Padding = 20;
            Content = new ScrollView {
                Content = new StackLayout{
                    Children = {
                        grid,

                        #region MaterialSegmentControl

                        //new StackLayout {
                        //	Orientation = StackOrientation.Horizontal,
                        //	Children = {

                                #region Light
                                new StackLayout {
                                    BackgroundColor = Color.Lime,
                                    HorizontalOptions = LayoutOptions.FillAndExpand,
                                    Padding = new Thickness(10),
                                    Children = {
                                        new Label {
                                            Text = "Default, Light",
                                            TextColor = Color.Black,
                                        },

                                        sc1, sc2, sc3, sc4, sc5, sc6,

                                    },
                                },
                                #endregion

                                #region Dark
                                new StackLayout {
                                    BackgroundColor = Color.FromHex("#003"),
                                    HorizontalOptions = LayoutOptions.FillAndExpand,
                                    Padding = new Thickness(10),
                                    Children = {
                                        new Label {
                                            Text = "Default, Dark",
                                            TextColor = Color.White,
                                        },

                                        new Forms9Patch.MaterialSegmentedControl {
                                            //OutlineColor = Color.Transparent,
                                            DarkTheme = true,
                                            Segments = {

                                                new Forms9Patch.Segment {
                                                    Text = "A",
                                                },
                                                new Forms9Patch.Segment {
                                                    //Text = "B",
                                                    IsSelected = true,
                                                    ImageSource = arrowIcon,
                                                },
                                                new Forms9Patch.Segment {
                                                    Text = "C",
                                                },

                                                new Forms9Patch.Segment {
                                                    Text = "D",
                                                    IsEnabled = false,
                                                },
                                            },
                                        },

                                        new Forms9Patch.MaterialSegmentedControl {
                                            DarkTheme = true,
                                            OutlineWidth = 0,
                                            Segments = {

                                                new Forms9Patch.Segment {
                                                    //Text = "A",
                                                    ImageSource = arrowIcon,
                                                },
                                                new Forms9Patch.Segment {
                                                    Text = "B",
                                                    IsSelected = true,
                                                },
                                                new Forms9Patch.Segment {
                                                    Text = "C",
                                                },

                                                new Forms9Patch.Segment {
                                                    Text = "D",
                                                    IsEnabled = false,
                                                },
                                            },
                                        },

                                        new Forms9Patch.MaterialSegmentedControl {
                                            DarkTheme = true,
                                            BackgroundColor = Color.FromHex("#1194F6"),
                                            Segments = {
                                                new Forms9Patch.Segment {
                                                    Text = "A",
                                                },
                                                new Forms9Patch.Segment {
                                                    Text = "B",
                                                    IsSelected = true,
                                                },
                                                new Forms9Patch.Segment {
                                                    Text = "C",
                                                },
                                                new Forms9Patch.Segment {
                                                    //Text = "D",
                                                    IsEnabled = false,
                                                    ImageSource = arrowIcon,
                                                },
                                            },
                                        },

                                        new Forms9Patch.MaterialSegmentedControl {
                                            DarkTheme = true,
                                            BackgroundColor = Color.FromHex("#1194F6"),
                                            OutlineWidth = 0,
                                            Segments = {
                                                new Forms9Patch.Segment {
                                                    Text = "A",
                                                    ImageSource = arrowIcon,
                                                    Orientation = StackOrientation.Vertical,
                                                },
                                                new Forms9Patch.Segment {
                                                    Text = "B",
                                                    IsSelected = true,
                                                    ImageSource = infoIcon,
                                                    Orientation = StackOrientation.Vertical,
                                                },

                                                new Forms9Patch.Segment {
                                                    Text = "C",
                                                    ImageSource = arrowIcon,
                                                },
                                                new Forms9Patch.Segment {
                                                    Text = "D",
                                                    IsEnabled = false,
                                                    ImageSource = infoIcon,
                                                    Orientation = StackOrientation.Vertical,
                                                },

                                            },
                                        },

                                        new Forms9Patch.MaterialSegmentedControl {
                                            DarkTheme = true,
                                            BackgroundColor = Color.FromHex("#1194F6"),
                                            HasShadow = true,
                                            //OutlineRadius = 0,
                                            //OutlineWidth = 0,
                                            Orientation = StackOrientation.Vertical,
                                            GroupToggleBehavior = Forms9Patch.GroupToggleBehavior.Multiselect,
                                            Segments = {

                                                new Forms9Patch.Segment {
                                                    Text = "A",
                                                    ImageSource = arrowIcon,
                                                },

                                                new Forms9Patch.Segment {
                                                    Text = "B",
                                                    IsSelected = true,
                                                },
                                                new Forms9Patch.Segment {
                                                    Text = "C",
                                                },
                                                new Forms9Patch.Segment {
                                                    Text = "D",
                                                    IsEnabled = false,
                                                },

                                            },
                                        },

                                        new Forms9Patch.MaterialSegmentedControl {
                                            DarkTheme = true,
                                            BackgroundColor = Color.FromHex("#1194F6"),
                                            HasShadow = true,
                                            //OutlineRadius = 0,
                                            OutlineWidth = 0,
                                            SeparatorWidth = 1,
                                            Orientation = StackOrientation.Vertical,
                                            GroupToggleBehavior = Forms9Patch.GroupToggleBehavior.Multiselect,
                                            Segments = {

                                                new Forms9Patch.Segment {
                                                    Text = "A",
                                                },

                                                new Forms9Patch.Segment {
                                                    Text = "B",
                                                    IsSelected = true,
                                                    ImageSource = arrowIcon,
                                                },
                                                new Forms9Patch.Segment {
                                                    Text = "C",
                                                },
                                                new Forms9Patch.Segment {
                                                    Text = "D",
                                                    IsEnabled = false,
                                                },

                                            },
                                        },
                                    },
                                },
                                #endregion

                        //	},
                        //},

                        #endregion

                    },
                },
            };
        }
コード例 #10
0
        public EllipticalMaterialButtonsPage()
        {
            var infoIcon  = Forms9Patch.ImageSource.FromMultiResource("Forms9PatchDemo.Resources.Info");
            var arrowIcon = Forms9Patch.ImageSource.FromMultiResource("Forms9PatchDemo.Resources.ArrowR");

            #region Material Buttons
            var grid = new Grid {
                RowDefinitions =
                {
                    new RowDefinition {
                        Height = GridLength.Auto
                    }
                },
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    }
                }
            };



            var mb1 = new Forms9Patch.MaterialButton {
                Text         = "",
                ImageSource  = arrowIcon,
                IsElliptical = true
            };
            mb1.Tapped       += OnMaterialButtonTapped;
            mb1.Selected     += OnMaterialButtonSelected;
            mb1.LongPressing += OnMaterialButtonLongPressing;
            mb1.LongPressed  += OnMaterialButtonLongPressed;
            var mb2 = new Forms9Patch.MaterialButton {
                //Text = "toggle",
                ToggleBehavior = true,
                ImageSource    = infoIcon,
                IsElliptical   = true,
            };
            mb2.Tapped       += OnMaterialButtonTapped;
            mb2.Selected     += OnMaterialButtonSelected;
            mb2.LongPressing += OnMaterialButtonLongPressing;
            mb2.LongPressed  += OnMaterialButtonLongPressed;
            var mb3 = new Forms9Patch.MaterialButton {
                //Text = "disabled",
                ToggleBehavior = true,
                IsEnabled      = false,
                ImageSource    = arrowIcon,
                IsElliptical   = true
            };
            mb3.Tapped       += OnMaterialButtonTapped;
            mb3.Selected     += OnMaterialButtonSelected;
            mb3.LongPressing += OnMaterialButtonLongPressing;
            mb3.LongPressed  += OnMaterialButtonLongPressed;
            var mb4 = new Forms9Patch.MaterialButton {
                //Text = "selected disabled",
                IsEnabled    = false,
                IsSelected   = true,
                ImageSource  = infoIcon,
                IsElliptical = true
            };
            mb4.Tapped       += OnMaterialButtonTapped;
            mb4.Selected     += OnMaterialButtonSelected;
            mb4.LongPressing += OnMaterialButtonLongPressing;
            mb4.LongPressed  += OnMaterialButtonLongPressed;


            var label1 = new Label {
                Text            = "Gesture Label",
                BackgroundColor = Color.Blue,
                HeightRequest   = 50
            };

            var label1Listener = FormsGestures.Listener.For(label1);
            label1Listener.Tapped       += (sender, e) => System.Diagnostics.Debug.WriteLine($"Tapped:{((Label)sender).Text}");
            label1Listener.DoubleTapped += (sender, e) => System.Diagnostics.Debug.WriteLine($"DoubleTapped:{((Label)sender).Text}");
            label1Listener.LongPressing += (sender, e) => System.Diagnostics.Debug.WriteLine($"LongPressing:{((Label)sender).Text}");
            // How to remove a listener!
            label1Listener.LongPressed += (sender, e) => {
                label1Listener.Dispose();
                System.Diagnostics.Debug.WriteLine("Removed FormsGestures.Listener");
            };


            grid.Children.Add(new StackLayout {
                BackgroundColor = Color.FromHex("#33FF33"),
                Padding         = new Thickness(10),
                Children        =
                {
                    new Label                      {
                        Text      = "Default, Light",
                        TextColor = Color.Black
                    },
                    mb1, mb2, mb3, mb4,

                    new Label                      {
                        Text      = "Outline, Light",
                        TextColor = Color.Black
                    },
                    new Forms9Patch.MaterialButton {
                        Text         = "",
                        ImageSource  = arrowIcon,
                        OutlineWidth = 0,
                        IsElliptical = true
                    },
                    new Forms9Patch.MaterialButton {
                        //Text = "toggle",
                        ToggleBehavior = true,
                        ImageSource    = infoIcon,
                        OutlineWidth   = 0,
                        IsElliptical   = true
                    },
                    new Forms9Patch.MaterialButton {
                        //Text = "disabled",
                        ToggleBehavior = true,
                        IsEnabled      = false,
                        ImageSource    = arrowIcon,
                        OutlineWidth   = 0,
                        IsElliptical   = true
                    },
                    new Forms9Patch.MaterialButton {
                        //Text = "selected disabled",
                        IsEnabled    = false,
                        IsSelected   = true,
                        ImageSource  = infoIcon,
                        OutlineWidth = 0,
                        IsElliptical = true
                    },

                    new Label                      {
                        Text      = "Background Color, Light Theme",
                        TextColor = Color.Black
                    },
                    new Forms9Patch.MaterialButton {
                        Text            = "default",
                        BackgroundColor = Color.FromHex("#E0E0E0"),
                        ImageSource     = arrowIcon,
                        Orientation     = StackOrientation.Vertical,
                        IsElliptical    = true
                    },
                    new Forms9Patch.MaterialButton {
                        Text            = "toggle",
                        ToggleBehavior  = true,
                        BackgroundColor = Color.FromHex("#E0E0E0"),
                        ImageSource     = infoIcon,
                        IsElliptical    = true
                    },
                    new Forms9Patch.MaterialButton {
                        Text            = "disabled",
                        ToggleBehavior  = true,
                        IsEnabled       = false,
                        BackgroundColor = Color.FromHex("#E0E0E0"),
                        ImageSource     = arrowIcon,
                        IsElliptical    = true
                    },
                    new Forms9Patch.MaterialButton {
                        Text            = "selected disabled",
                        IsEnabled       = false,
                        IsSelected      = true,
                        BackgroundColor = Color.FromHex("#E0E0E0"),
                        ImageSource     = infoIcon,
                        IsElliptical    = true
                    },

                    new Label                      {
                        Text      = "Shadow, Light Theme",
                        TextColor = Color.Black
                    },
                    new Forms9Patch.MaterialButton {
                        Text         = "default",
                        HasShadow    = true,
                        ImageSource  = infoIcon,
                        IsElliptical = true
                    },
                    new Forms9Patch.MaterialButton {
                        Text           = "toggle",
                        ToggleBehavior = true,
                        HasShadow      = true,
                        ImageSource    = arrowIcon,
                        IsElliptical   = true
                    },
                    new Forms9Patch.MaterialButton {
                        Text           = "disabled",
                        ToggleBehavior = true,
                        IsEnabled      = false,
                        HasShadow      = true,
                        ImageSource    = infoIcon,
                        IsElliptical   = true
                    },
                    new Forms9Patch.MaterialButton {
                        Text         = "selected disabled",
                        IsEnabled    = false,
                        IsSelected   = true,
                        HasShadow    = true,
                        ImageSource  = arrowIcon,
                        IsElliptical = true
                    },

                    new Label                      {
                        Text      = "Shadow Background Color, Light Theme",
                        TextColor = Color.Black
                    },
                    new Forms9Patch.MaterialButton {
                        Text            = "default",
                        BackgroundColor = Color.FromHex("#E0E0E0"),
                        HasShadow       = true,
                        ImageSource     = infoIcon,
                        IsElliptical    = true
                    },
                    new Forms9Patch.MaterialButton {
                        Text            = "toggle",
                        ToggleBehavior  = true,
                        BackgroundColor = Color.FromHex("#E0E0E0"),
                        HasShadow       = true,
                        ImageSource     = arrowIcon,
                        IsElliptical    = true
                    },
                    new Forms9Patch.MaterialButton {
                        Text            = "disabled",
                        ToggleBehavior  = true,
                        IsEnabled       = false,
                        BackgroundColor = Color.FromHex("#E0E0E0"),
                        HasShadow       = true,
                        ImageSource     = infoIcon,
                        IsElliptical    = true
                    },
                    new Forms9Patch.MaterialButton {
                        Text            = "selected disabled",
                        IsEnabled       = false,
                        IsSelected      = true,
                        BackgroundColor = Color.FromHex("#E0E0E0"),
                        HasShadow       = true,
                        ImageSource     = arrowIcon,
                        IsElliptical    = true
                    },
                },
            }, 0, 0);


            grid.Children.Add(new StackLayout {
                Padding         = new Thickness(10),
                BackgroundColor = Color.FromHex("#003"),
                Children        =
                {
                    new Label                      {
                        Text      = "Default, Dark Theme",
                        TextColor = Color.White
                    },
                    new Forms9Patch.MaterialButton {
                        Text         = "default",
                        DarkTheme    = true,
                        IsElliptical = true
                    },
                    new Forms9Patch.MaterialButton {
                        Text           = "toggle",
                        ToggleBehavior = true,
                        DarkTheme      = true,
                        IsElliptical   = true
                    },
                    new Forms9Patch.MaterialButton {
                        Text           = "disabled",
                        ToggleBehavior = true,
                        IsEnabled      = false,
                        DarkTheme      = true,
                        IsElliptical   = true
                    },
                    new Forms9Patch.MaterialButton {
                        Text         = "selected disabled",
                        IsEnabled    = false,
                        IsSelected   = true,
                        DarkTheme    = true,
                        IsElliptical = true
                    },

                    new Label                      {
                        Text      = "Outline, Dark Theme",
                        TextColor = Color.White
                    },
                    new Forms9Patch.MaterialButton {
                        Text         = "default",
                        DarkTheme    = true,
                        OutlineWidth = 0,
                        IsElliptical = true
                    },
                    new Forms9Patch.MaterialButton {
                        Text           = "toggle",
                        ToggleBehavior = true,
                        DarkTheme      = true,
                        OutlineWidth   = 0,
                        IsElliptical   = true
                    },
                    new Forms9Patch.MaterialButton {
                        Text           = "disabled",
                        ToggleBehavior = true,
                        IsEnabled      = false,
                        DarkTheme      = true,
                        OutlineWidth   = 0,
                        IsElliptical   = true
                    },
                    new Forms9Patch.MaterialButton {
                        Text         = "selected disabled",
                        IsEnabled    = false,
                        IsSelected   = true,
                        DarkTheme    = true,
                        OutlineWidth = 0,
                        IsElliptical = true
                    },

                    new Label                      {
                        Text      = "Background Color, Dark Theme",
                        TextColor = Color.White
                    },
                    new Forms9Patch.MaterialButton {
                        Text            = "default",
                        BackgroundColor = Color.FromHex("#1194F6"),
                        DarkTheme       = true,
                        ImageSource     = arrowIcon,
                        Orientation     = StackOrientation.Vertical,
                        IsElliptical    = true
                    },
                    new Forms9Patch.MaterialButton {
                        Text            = "toggle",
                        ToggleBehavior  = true,
                        BackgroundColor = Color.FromHex("#1194F6"),
                        DarkTheme       = true,
                        IsElliptical    = true
                    },

                    new Forms9Patch.MaterialButton {
                        Text            = "disabled",
                        ToggleBehavior  = true,
                        IsEnabled       = false,
                        BackgroundColor = Color.FromHex("#1194F6"),
                        DarkTheme       = true,
                        IsElliptical    = true
                    },

                    new Forms9Patch.MaterialButton {
                        Text            = "selected disabled",
                        IsEnabled       = false,
                        IsSelected      = true,
                        BackgroundColor = Color.FromHex("#1194F6"),
                        DarkTheme       = true,
                        IsElliptical    = true
                    },
                    new Label                      {
                        Text      = "Shadow, Dark Theme",
                        TextColor = Color.White
                    },
                    new Forms9Patch.MaterialButton {
                        Text         = "default",
                        DarkTheme    = true,
                        HasShadow    = true,
                        IsElliptical = true
                    },
                    new Forms9Patch.MaterialButton {
                        Text           = "toggle",
                        ToggleBehavior = true,
                        DarkTheme      = true,
                        HasShadow      = true,
                        IsElliptical   = true
                    },
                    new Forms9Patch.MaterialButton {
                        Text           = "disabled",
                        ToggleBehavior = true,
                        IsEnabled      = false,
                        DarkTheme      = true,
                        HasShadow      = true,
                        IsElliptical   = true
                    },
                    new Forms9Patch.MaterialButton {
                        Text         = "selected disabled",
                        IsEnabled    = false,
                        IsSelected   = true,
                        DarkTheme    = true,
                        HasShadow    = true,
                        IsElliptical = true
                    },
                    new Label                      {
                        Text      = "Shadow Background Color, Dark Theme",
                        TextColor = Color.White
                    },
                    new Forms9Patch.MaterialButton {
                        Text            = "default",
                        BackgroundColor = Color.FromHex("#1194F6"),
                        DarkTheme       = true,
                        HasShadow       = true,
                        IsElliptical    = true
                    },
                    new Forms9Patch.MaterialButton {
                        Text            = "toggle",
                        ToggleBehavior  = true,
                        BackgroundColor = Color.FromHex("#1194F6"),
                        DarkTheme       = true,
                        HasShadow       = true,
                        IsElliptical    = true
                    },

                    new Forms9Patch.MaterialButton {
                        Text            = "disabled",
                        ToggleBehavior  = true,
                        IsEnabled       = false,
                        BackgroundColor = Color.FromHex("#1194F6"),
                        DarkTheme       = true,
                        HasShadow       = true,
                        IsElliptical    = true
                    },

                    new Forms9Patch.MaterialButton {
                        Text            = "selected disabled",
                        IsEnabled       = false,
                        IsSelected      = true,
                        BackgroundColor = Color.FromHex("#1194F6"),
                        DarkTheme       = true,
                        HasShadow       = true,
                        IsElliptical    = true
                    },
                },
            }, 1, 0);
            #endregion


            Padding = 20;
            Content = new ScrollView {
                Content = new StackLayout {
                    Children =
                    {
                        grid,
                    },
                },
            };
        }