Ejemplo n.º 1
0
        public LegacyColorModePageCS()
        {
            _defaultColorModeButton = new Xamarin.Forms.Button {
                Text = "Button", TextColor = Color.Blue, BackgroundColor = Color.Bisque
            };
            var defaultIsEnabledButton = new Xamarin.Forms.Button {
                Text = "Toggle IsEnabled"
            };

            defaultIsEnabledButton.Clicked += (sender, e) =>
            {
                var button = sender as Xamarin.Forms.Button;
                ToggleIsEnabled(_defaultColorModeButton, button);
            };

            _legacyColorModeDisabledButton = new Xamarin.Forms.Button {
                Text = "Button", TextColor = Color.Blue, BackgroundColor = Color.Bisque
            };
            _legacyColorModeDisabledButton.On <iOS>().SetIsLegacyColorModeEnabled(false);
            _legacyColorModeDisabledButton.On <Android>().SetIsLegacyColorModeEnabled(false);
            _legacyColorModeDisabledButton.On <Windows>().SetIsLegacyColorModeEnabled(false);

            var legacyColorModeDisabledIsEnabledButton = new Xamarin.Forms.Button {
                Text = "Toggle IsEnabled"
            };

            legacyColorModeDisabledIsEnabledButton.Clicked += (sender, e) =>
            {
                var button = sender as Xamarin.Forms.Button;
                ToggleIsEnabled(_legacyColorModeDisabledButton, button);
            };

            Title   = "Legacy Color Mode";
            Content = new StackLayout
            {
                Margin   = new Thickness(20),
                Children =
                {
                    new Xamarin.Forms.Label {
                        Text = "The Button below uses the legacy color mode. When IsEnabled is false, it uses the default native colors for the control."
                    },
                    _defaultColorModeButton,
                    defaultIsEnabledButton,
                    new Xamarin.Forms.Label {
                        Text = "The Button below has the legacy color mode disabled. It will use whatever colors are manually set."
                    },
                    _legacyColorModeDisabledButton,
                    legacyColorModeDisabledIsEnabledButton
                }
            };
        }
Ejemplo n.º 2
0
        ContentPage CreatePage(int pageNumber)
        {
            var returnButton = new Xamarin.Forms.Button {
                Text = "Return to Platform-Specifics List"
            };

            returnButton.Clicked += (sender, e) => _returnToPlatformSpecificsPage.Execute(null);
            returnButton.On <Windows>()
            .SetAccessKey("G")
            .SetAccessKeyPlacement(AccessKeyPlacement.Bottom);

            var page = new ContentPage
            {
                Title   = $"Page {pageNumber}",
                Icon    = "csharp.png",
                Content = new StackLayout
                {
                    Margin   = new Thickness(20),
                    Children =
                    {
                        new Xamarin.Forms.Label {
                            Text = "Press the alt key once to see the access keys, then press the alt key and an access key.", FontAttributes = FontAttributes.Bold
                        },
                        returnButton
                    }
                }
            };

            page.On <Windows>().SetAccessKey(pageNumber.ToString());
            return(page);
        }
Ejemplo n.º 3
0
        async void ITest.Test(Xamarin.Forms.Button element)
        {
            var androidButton = (Android.Widget.Button) await element.On <Xamarin.Forms.PlatformConfiguration.Android>().AndroidAsync();

            androidButton.Text = "I was changed nativly";
            androidButton.SetBackgroundColor(Android.Graphics.Color.Bisque);
        }
Ejemplo n.º 4
0
        public AndroidButtonPageCS()
        {
            var button1 = new Xamarin.Forms.Button {
                Text = "Button", BackgroundColor = Color.Bisque, TextColor = Color.Blue, CornerRadius = 50, HeightRequest = 100, WidthRequest = 100, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center
            };
            var button2 = new Xamarin.Forms.Button {
                Text = "Button", BackgroundColor = Color.Bisque, TextColor = Color.Blue, CornerRadius = 50, HeightRequest = 100, WidthRequest = 100, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center
            };

            button2.On <Android>().SetUseDefaultPadding(true).SetUseDefaultShadow(true);

            Title   = "Button Default Padding and Shadow";
            Content = new StackLayout
            {
                Margin   = new Thickness(20),
                Children =
                {
                    new Label {
                        Text = "The following buttons have identical definitions, except that the second button uses the default padding and default shadow platform-specifics."
                    },
                    new StackLayout
                    {
                        Orientation       = StackOrientation.Horizontal,
                        HorizontalOptions = LayoutOptions.Center,
                        Children          =
                        {
                            button1, button2
                        }
                    }
                }
            };
        }
Ejemplo n.º 5
0
        public AudioLayout()
        {
            Orientation          = StackOrientation.Horizontal;
            playButton.Released += OnPlayButtonClicked;
            scrollBackButton.On <TizenConfig>().SetStyle(ButtonStyle.Circle);
            playButton.On <TizenConfig>().SetStyle(ButtonStyle.Circle);
            scrollForwardButton.On <TizenConfig>().SetStyle(ButtonStyle.Circle);

            Children.Add(scrollBackButton);
            Children.Add(playButton);
            Children.Add(scrollForwardButton);
            Children.Add(durationLabel);
        }
Ejemplo n.º 6
0
        public AndroidElevationPageCS()
        {
            var outputLabel = new Label();
            var aboveButton = new Xamarin.Forms.Button {
                Text = "Button Above BoxView - Click Me"
            };

            aboveButton.Clicked += (sender, e) => outputLabel.Text = "The bottom button can receive input, while the top button cannot.";
            aboveButton.On <Android>().SetElevation(10);

            Title   = "Elevation";
            Content = new StackLayout
            {
                Margin   = new Thickness(20),
                Children =
                {
                    new Grid
                    {
                        Children =
                        {
                            new Xamarin.Forms.Button {
                                Text = "Button Beneath BoxView"
                            },
                            new BoxView              {
                                Color = Color.Red, Opacity = 0.2, HeightRequest = 50
                            }
                        }
                    },
                    new Grid
                    {
                        Margin   = new Thickness(0, 20, 0, 0),
                        Children =
                        {
                            aboveButton,
                            new BoxView              {
                                Color = Color.Red,Opacity            = 0.2, HeightRequest = 50
                            }
                        }
                    },
                    outputLabel
                }
            };
        }