예제 #1
0
        void createPopup1()
        {
            var checkbox = new Switch();

            checkbox.On <Xamarin.Forms.PlatformConfiguration.Tizen>().SetStyle("small");
            checkbox.Toggled += (s, e) =>
            {
                Console.WriteLine($"checkbox toggled. checkbox.IsToggled:{checkbox.IsToggled}");
            };

            _popUp1              = new TwoButtonPopup();
            _popUp1.Title        = "Popup title";
            _popUp1.FirstButton  = _leftButton;
            _popUp1.SecondButton = _rightButton;
            _popUp1.Content      = new StackLayout
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Children          =
                {
                    new Label
                    {
                        Text = "Will be saved, and sound, only on the Gear.",
                    },
                    new StackLayout
                    {
                        Orientation = StackOrientation.Horizontal,
                        Padding     = new Thickness(0, 40, 0, 40),
                        Children    =
                        {
                            checkbox,
                            new Label
                            {
                                Text = "Do not repeat",
                            }
                        }
                    }
                }
            };

            _popUp1.BackButtonPressed += (s, e) =>
            {
                _popUp1?.Dismiss();
                _popUp1     = null;
                label1.Text = "Popup1 is dismissed";
            };

            _popUp1.FirstButton.Clicked  += (s, e) => Console.WriteLine("First(share) button clicked!");
            _popUp1.SecondButton.Clicked += (s, e) => Console.WriteLine("Second(delete) button clicked!");
        }
예제 #2
0
        public TCTwoButtonPopup()
        {
            InitializeComponent();

            _leftButton = new MenuItem
            {
#pragma warning disable CS0618 // Icon is obsolete. This code is for checking backword compatibility.
                Icon = new FileImageSource
#pragma warning restore CS0618
                {
                    File = "image/b_option_list_icon_share.png",
                },
                Command = new Command(() =>
                {
                    Console.WriteLine("left button1 Command!!");
                    _popUp1?.Dismiss();
                    _popUp1 = null;
                })
            };

            _rightButton = new MenuItem
            {
#pragma warning disable CS0618 // Icon is obsolete. This code is for checking backword compatibility.
                Icon = new FileImageSource
#pragma warning restore CS0618
                {
                    File = "image/b_option_list_icon_delete.png",
                },
                Command = new Command(() =>
                {
                    Console.WriteLine("right button1 Command!!");
                    _popUp1?.Dismiss();
                    _popUp1 = null;
                })
            };

            _noIconLeftButton = new MenuItem
            {
                Text    = "No icon left button",
                Command = new Command(() =>
                {
                    Console.WriteLine("No icon left button Command!!");
                    _popUp1?.Dismiss();
                    _popUp1 = null;
                })
            };

            _noIconRightButton = new MenuItem
            {
                Text    = "No icon right button",
                Command = new Command(() =>
                {
                    Console.WriteLine("no icon right button Command!!");
                    _popUp1?.Dismiss();
                    _popUp1 = null;
                })
            };

            var mySwitch = new Switch();
            mySwitch.On <Xamarin.Forms.PlatformConfiguration.Tizen>().SetStyle("small");

            _content = new StackLayout
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Children          =
                {
                    new Label
                    {
                        Text      = "This is Label of Content area on Two button Popup.",
                        TextColor = Color.LightSkyBlue,
                    },
                    new StackLayout
                    {
                        Orientation = StackOrientation.Horizontal,
                        Padding     = new Thickness(0, 40, 0, 40),
                        Children    =
                        {
                            mySwitch,
                            new Label
                            {
                                Text = "Do not repeat",
                            }
                        }
                    }
                }
            };

            _longText = @"This is scrollable popup text.
This part is made by adding long text in popup. Popup internally added
scroller to this layout when size of text is greater than total popup
height. This has two button in action area and title text in title area";
        }