Example #1
0
        public ZenmekPage()
        {
            ibStartStop = new Forms9Patch.ImageButton
            {
                DefaultState = new Forms9Patch.ImageButtonState
                {
                    BackgroundImage = new Forms9Patch.Image
                    {
                        Source = Forms9Patch.ImageSource.FromResource(BaseResource + ".Resources.button_01_default.png"),
                    },
                    FontColor = Color.Black,
                    Text = "Start",
                },
                PressingState = new Forms9Patch.ImageButtonState
                {
                    BackgroundImage = new Forms9Patch.Image
                    {
                        Source = Forms9Patch.ImageSource.FromResource(BaseResource + ".Resources.button_01_pressing.png"),
                    },
                },
                ToggleBehavior = true,
                HeightRequest = 50,
                Alignment = TextAlignment.Center,
            };

            StackLayout slMain = new StackLayout()
            {
                Orientation = StackOrientation.Vertical,
                Children =
                    {
                        ibStartStop
                    }
            };

            //ContentView fnpcvMain = new ContentView
            Forms9Patch.ContentView fnpcvMain = new Forms9Patch.ContentView
            {
                Content = slMain,
            };

            //Issue happens with this:
            Content = fnpcvMain;

            //It works fine with this:
            //Content = slMain;
        }
Example #2
0
        public ZenmekPage()
        {
            ibStartStop = new Forms9Patch.ImageButton
            {
                DefaultState = new Forms9Patch.ImageButtonState
                {
                    BackgroundImage = new Forms9Patch.Image
                    {
                        Source = Forms9Patch.ImageSource.FromResource(BaseResource + ".Resources.button_01_default.png"),
                    },
                    FontColor = Color.Black,
                    Text      = "Start",
                },
                PressingState = new Forms9Patch.ImageButtonState
                {
                    BackgroundImage = new Forms9Patch.Image
                    {
                        Source = Forms9Patch.ImageSource.FromResource(BaseResource + ".Resources.button_01_pressing.png"),
                    },
                },
                ToggleBehavior = true,
                HeightRequest  = 50,
                Alignment      = TextAlignment.Center,
            };

            StackLayout slMain = new StackLayout()
            {
                Orientation = StackOrientation.Vertical,
                Children    =
                {
                    ibStartStop
                }
            };

            //ContentView fnpcvMain = new ContentView
            Forms9Patch.ContentView fnpcvMain = new Forms9Patch.ContentView
            {
                Content = slMain,
            };

            //Issue happens with this:
            Content = fnpcvMain;

            //It works fine with this:
            //Content = slMain;
        }
        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,
                }
            };
        }
        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,
                }
            };
        }
Example #5
0
        public ImageButtonCodePage()
        {
            #region ImageButtons
            var b2 = 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",
                },
                SelectedState = new Forms9Patch.ImageButtonState {
                    BackgroundImage = new Forms9Patch.Image {
                        Source = Forms9Patch.ImageSource.FromMultiResource("Forms9PatchDemo.Resources.image"),
                    },
                    FontColor = Color.Red,
                    Text      = "Selected",
                },
                StickyBehavior = true,
                HeightRequest  = 50,
                Alignment      = TextAlignment.Start,
            };
            b2.Tapped       += OnImageButtonTapped;
            b2.Selected     += OnImageButtonSelected;
            b2.LongPressing += OnImageButtonLongPressing;
            b2.LongPressed  += OnImageButtonLongPressed;


            var b3 = 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.FromRgb(0.0, 0.0, 0.8),
                    Text      = "Sticky w/o SelectedState",
                },
                PressingState = new Forms9Patch.ImageButtonState {
                    BackgroundImage = new Forms9Patch.Image {
                        Source = Forms9Patch.ImageSource.FromMultiResource("Forms9PatchDemo.Resources.redButton"),
                    },
                },
                StickyBehavior = true,
                HeightRequest  = 50,
                Alignment      = TextAlignment.Center,
            };
            b3.Tapped       += OnImageButtonTapped;
            b3.Selected     += OnImageButtonSelected;
            b3.LongPressing += OnImageButtonLongPressing;
            b3.LongPressed  += OnImageButtonLongPressed;

            var b4 = 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      = "Not sticky",
                },
                //StickyBehavior = true,
                HeightRequest = 50,
                Alignment     = TextAlignment.End,
            };
            b4.Tapped       += OnImageButtonTapped;
            b4.Selected     += OnImageButtonSelected;
            b4.LongPressing += OnImageButtonLongPressing;
            b4.LongPressed  += OnImageButtonLongPressed;

            #endregion


            Content = new StackLayout {
                Children =
                {
                    new Label {
                        Text = "Buttons Page"
                    },
                    b2, b3, b4,
                }
            };
        }
        public ImageButtonCodePage()
        {
            #region ImageButtons
            var b2 = 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",
                },
                SelectedState = new Forms9Patch.ImageButtonState {
                    BackgroundImage = new Forms9Patch.Image {
                        Source = Forms9Patch.ImageSource.FromMultiResource ("Forms9PatchDemo.Resources.image"),
                    },
                    FontColor = Color.Red,
                    Text = "Selected",
                },
                ToggleBehavior = true,
                HeightRequest = 50,
                Alignment = TextAlignment.Start,
            };
            b2.Tapped += OnImageButtonTapped;
            b2.Selected += OnImageButtonSelected;
            b2.LongPressing += OnImageButtonLongPressing;
            b2.LongPressed += OnImageButtonLongPressed;

            var b3 = 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.FromRgb(0.0, 0.0, 0.8),
                    Text = "Sticky w/o SelectedState",
                },
                PressingState = new Forms9Patch.ImageButtonState {
                    BackgroundImage = new Forms9Patch.Image {
                        Source = Forms9Patch.ImageSource.FromMultiResource ("Forms9PatchDemo.Resources.redButton"),
                    },
                },
                ToggleBehavior = true,
                HeightRequest = 50,
                Alignment = TextAlignment.Center,
            };
            b3.Tapped += OnImageButtonTapped;
            b3.Selected += OnImageButtonSelected;
            b3.LongPressing += OnImageButtonLongPressing;
            b3.LongPressed += OnImageButtonLongPressed;

            var b4 = 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 = "Not toggle",
                },
                //ToggleBehavior = true,
                HeightRequest = 50,
                Alignment = TextAlignment.End,
            };
            b4.Tapped += OnImageButtonTapped;
            b4.Selected += OnImageButtonSelected;
            b4.LongPressing += OnImageButtonLongPressing;
            b4.LongPressed += OnImageButtonLongPressed;

            #endregion

            Content = new StackLayout {
                Children = {
                    new Label { Text = "Buttons Page" },
                    b2,b3,b4,

                }
            };
        }