Exemplo n.º 1
0
        protected override void Build(StackLayout stackLayout)
        {
            base.Build(stackLayout);
            var formatContainer = new ViewContainer <TimePicker>(Test.TimePicker.Format, new TimePicker {
                Format = "HH-mm-ss"
            });
            var timeContainer = new ViewContainer <TimePicker>(Test.TimePicker.Time,
                                                               new TimePicker {
                Time = new TimeSpan(14, 45, 50)
            });
            var textColorContainer = new ViewContainer <TimePicker>(Test.TimePicker.TextColor,
                                                                    new TimePicker {
                Time = new TimeSpan(14, 45, 50), TextColor = Color.Lime
            });
            var fontAttributesContainer = new ViewContainer <TimePicker>(Test.TimePicker.FontAttributes,
                                                                         new TimePicker {
                FontAttributes = FontAttributes.Bold
            });

            var fontFamilyContainer = new ViewContainer <TimePicker>(Test.TimePicker.FontFamily,
                                                                     new TimePicker());

            // Set font family based on available fonts per platform
            switch (Device.RuntimePlatform)
            {
            case Device.Android:
                fontFamilyContainer.View.FontFamily = "sans-serif-thin";
                break;

            case Device.iOS:
                fontFamilyContainer.View.FontFamily = "Courier";
                break;

            default:
                fontFamilyContainer.View.FontFamily = "Garamond";
                break;
            }

            var fontSizeContainer = new ViewContainer <TimePicker>(Test.TimePicker.FontSize,
                                                                   new TimePicker {
                FontSize = 24
            });

            Add(formatContainer);
            Add(timeContainer);
            Add(textColorContainer);
            Add(fontAttributesContainer);
            Add(fontFamilyContainer);
            Add(fontSizeContainer);
        }
Exemplo n.º 2
0
        protected override void Build(StackLayout stackLayout)
        {
            base.Build(stackLayout);

            var progressContainer = new ViewContainer <ProgressBar>(Test.ProgressBar.Progress, new ProgressBar {
                Progress = 0.5
            });
            var colorContainer = new ViewContainer <ProgressBar>(Test.ProgressBar.ProgressColor, new ProgressBar {
                ProgressColor = Color.Lime, Progress = 0.5
            });

            Add(progressContainer);
            Add(colorContainer);
        }
Exemplo n.º 3
0
        protected override void Build(StackLayout stackLayout)
        {
            base.Build(stackLayout);

            var refreshColorContainer = new ViewContainer <RefreshView>(Test.RefreshView.RefreshColor, new RefreshView
            {
                Content      = CreateContent(),
                RefreshColor = Color.Red
            });

            refreshColorContainer.View.SetBinding(RefreshView.CommandProperty, "RefreshCommand");
            refreshColorContainer.View.SetBinding(RefreshView.IsRefreshingProperty, "IsRefreshing");

            Add(refreshColorContainer);
        }
Exemplo n.º 4
0
        protected override void Build(StackLayout stackLayout)
        {
            base.Build(stackLayout);

            var colorContainer = new ViewContainer <BoxView> (Test.BoxView.Color, new BoxView {
                Color = Color.Pink
            });

            Add(colorContainer);

            var cornerRadiusContainer = new ViewContainer <BoxView>(Test.BoxView.CornerRadius, new BoxView {
                Color = Color.Red, CornerRadius = new CornerRadius(0, 12, 12, 0)
            });

            Add(cornerRadiusContainer);
        }
Exemplo n.º 5
0
        public KeyboardCoreGallery()
        {
            var keyboardTypes = new[] {
                Keyboard.Chat,
                Keyboard.Default,
                Keyboard.Email,
                Keyboard.Numeric,
                Keyboard.Plain,
                Keyboard.Telephone,
                Keyboard.Text,
                Keyboard.Url
            };

            var layout = new StackLayout();

            foreach (var keyboardType in keyboardTypes)
            {
                var viewContainer = new ViewContainer <Entry> (Test.InputView.Keyboard, new Entry {
                    Placeholder = keyboardType.ToString(), Keyboard = keyboardType
                });
                layout.Children.Add(viewContainer.ContainerLayout);
            }

            var customKeyboards = new [] {
                Tuple.Create("None", Keyboard.Create(KeyboardFlags.None)),
                Tuple.Create("Suggestions", Keyboard.Create(KeyboardFlags.Suggestions)),
                Tuple.Create("Spellcheck", Keyboard.Create(KeyboardFlags.Spellcheck)),
                Tuple.Create("SpellcheckSuggestions", Keyboard.Create(KeyboardFlags.Spellcheck | KeyboardFlags.Suggestions)),
                Tuple.Create("Capitalize", Keyboard.Create(KeyboardFlags.CapitalizeSentence)),
                Tuple.Create("CapitalizeSuggestions", Keyboard.Create(KeyboardFlags.CapitalizeSentence | KeyboardFlags.Suggestions)),
                Tuple.Create("CapitalizeSpellcheck", Keyboard.Create(KeyboardFlags.CapitalizeSentence | KeyboardFlags.Spellcheck)),
                Tuple.Create("CapitalizeSpellcheckSuggestions", Keyboard.Create(KeyboardFlags.CapitalizeSentence | KeyboardFlags.Spellcheck | KeyboardFlags.Suggestions)),
                Tuple.Create("All", Keyboard.Create(KeyboardFlags.All)),
            };

            foreach (var customKeyboard in customKeyboards)
            {
                var viewContainer = new ViewContainer <Entry> (Test.InputView.Keyboard, new Entry {
                    Placeholder = customKeyboard.Item1, Keyboard = customKeyboard.Item2
                });
                layout.Children.Add(viewContainer.ContainerLayout);
            }

            Content = new ScrollView {
                Content = layout
            };
        }
Exemplo n.º 6
0
        protected override void Build(StackLayout stackLayout)
        {
            base.Build(stackLayout);

            var colorContainer = new ViewContainer <ActivityIndicator> (Test.ActivityIndicator.Color, new ActivityIndicator {
                Color     = Color.Lime,
                IsRunning = true
            });

            var isRunningContainer = new StateViewContainer <ActivityIndicator> (Test.ActivityIndicator.IsRunning, new ActivityIndicator {
                IsRunning = true
            });

            isRunningContainer.StateChangeButton.Clicked += (sender, args) => {
                isRunningContainer.View.IsRunning = !isRunningContainer.View.IsRunning;
            };

            Add(colorContainer);
            Add(isRunningContainer);
        }
Exemplo n.º 7
0
        protected override void Build(StackLayout stackLayout)
        {
            base.Build(stackLayout);

            var tableSectionContainer = new ViewContainer <TableView>(Test.TableView.TableSection, new TableView());
            var section = new TableSection("Test")
            {
                TextColor = Color.Red
            };

            section.Add(new TextCell {
                Text = "Worked!"
            });

            var section1 = new TableSection("Testing")
            {
                TextColor = Color.Green
            };

            section1.Add(new TextCell {
                Text = "Workeding!"
            });

            var section2 = new TableSection("Test old")
            {
                new TextCell {
                    Text = "Worked old!"
                }
            };

            tableSectionContainer.View.Root.Add(section);
            tableSectionContainer.View.Root.Add(section1);
            tableSectionContainer.View.Root.Add(section2);

            Add(tableSectionContainer);
        }
Exemplo n.º 8
0
        protected override void Build(StackLayout stackLayout)
        {
            base.Build(stackLayout);

            var dateContainer = new ViewContainer <DatePicker>(Test.DatePicker.Date,
                                                               new DatePicker {
                Date = new DateTime(1987, 9, 13)
            });

            var dateSelectedContainer = new EventViewContainer <DatePicker>(Test.DatePicker.DateSelected, new DatePicker());

            dateSelectedContainer.View.DateSelected += (sender, args) => dateSelectedContainer.EventFired();

            var formatDateContainer = new ViewContainer <DatePicker>(Test.DatePicker.Format, new DatePicker {
                Format = "ddd"
            });
            var minimumDateContainer = new ViewContainer <DatePicker>(Test.DatePicker.MinimumDate,
                                                                      new DatePicker {
                MinimumDate = new DateTime(1987, 9, 13)
            });
            var maximumDateContainer = new ViewContainer <DatePicker>(Test.DatePicker.MaximumDate,
                                                                      new DatePicker {
                MaximumDate = new DateTime(2087, 9, 13)
            });
            var textColorContainer = new ViewContainer <DatePicker>(Test.DatePicker.TextColor,
                                                                    new DatePicker {
                Date = new DateTime(1978, 12, 24), TextColor = Color.Lime
            });
            var fontAttributesContainer = new ViewContainer <DatePicker>(Test.DatePicker.FontAttributes,
                                                                         new DatePicker {
                FontAttributes = FontAttributes.Bold
            });

            var fontFamilyContainer = new ViewContainer <DatePicker>(Test.DatePicker.FontFamily,
                                                                     new DatePicker());

            // Set font family based on available fonts per platform
            switch (Device.RuntimePlatform)
            {
            case Device.Android:
                fontFamilyContainer.View.FontFamily = "sans-serif-thin";
                break;

            case Device.iOS:
                fontFamilyContainer.View.FontFamily = "Courier";
                break;

            default:
                fontFamilyContainer.View.FontFamily = "Garamond";
                break;
            }

            var fontSizeContainer = new ViewContainer <DatePicker>(Test.DatePicker.FontSize,
                                                                   new DatePicker {
                FontSize = 24
            });

            Add(dateContainer);
            Add(dateSelectedContainer);
            Add(formatDateContainer);
            Add(minimumDateContainer);
            Add(maximumDateContainer);
            Add(textColorContainer);
            Add(fontAttributesContainer);
            Add(fontFamilyContainer);
            Add(fontSizeContainer);
        }
Exemplo n.º 9
0
        protected override void Build(StackLayout stackLayout)
        {
            base.Build(stackLayout);

            var viewModel = new ListViewViewModel();

            var groupDisplayBindingContainer = new ViewContainer <ListView>(Test.ListView.GroupDisplayBinding, new ListView());

            InitializeElementListView(groupDisplayBindingContainer.View, 0);
            groupDisplayBindingContainer.View.ItemsSource         = viewModel.CategorizedEmployees;
            groupDisplayBindingContainer.View.IsGroupingEnabled   = true;
            groupDisplayBindingContainer.View.GroupDisplayBinding = new Binding("Key");


            var groupHeaderTemplateContainer = new ViewContainer <ListView>(Test.ListView.GroupHeaderTemplate, new ListView());

            InitializeElementListView(groupHeaderTemplateContainer.View, 0);
            groupHeaderTemplateContainer.View.ItemsSource         = viewModel.CategorizedEmployees;
            groupHeaderTemplateContainer.View.IsGroupingEnabled   = true;
            groupHeaderTemplateContainer.View.GroupHeaderTemplate = new DataTemplate(typeof(HeaderCell));

            var groupShortNameContainer = new ViewContainer <ListView>(Test.ListView.GroupShortNameBinding, new ListView());

            InitializeElementListView(groupShortNameContainer.View, 0);
            groupShortNameContainer.View.ItemsSource           = viewModel.CategorizedEmployees;
            groupShortNameContainer.View.IsGroupingEnabled     = true;
            groupShortNameContainer.View.GroupShortNameBinding = new Binding("Key");

            // TODO - not sure how to do this
            var hasUnevenRowsContainer = new ViewContainer <ListView>(Test.ListView.HasUnevenRows, new ListView());

            InitializeElement(hasUnevenRowsContainer.View);
            hasUnevenRowsContainer.View.HasUnevenRows = true;
            hasUnevenRowsContainer.View.ItemTemplate  = new DataTemplate(typeof(UnevenCell));

            var isGroupingEnabledContainer = new StateViewContainer <ListView>(Test.ListView.IsGroupingEnabled, new ListView());

            InitializeElement(isGroupingEnabledContainer.View);
            isGroupingEnabledContainer.View.ItemsSource           = viewModel.CategorizedEmployees;
            isGroupingEnabledContainer.View.IsGroupingEnabled     = true;
            isGroupingEnabledContainer.StateChangeButton.Clicked += (sender, args) => isGroupingEnabledContainer.View.IsGroupingEnabled = !isGroupingEnabledContainer.View.IsGroupingEnabled;


            var itemAppearingContainer = new EventViewContainer <ListView>(Test.ListView.ItemAppearing, new ListView());

            InitializeElement(itemAppearingContainer.View);
            itemAppearingContainer.View.ItemAppearing += (sender, args) => itemAppearingContainer.EventFired();

            var itemDisappearingContainer = new EventViewContainer <ListView>(Test.ListView.ItemDisappearing, new ListView());

            InitializeElement(itemDisappearingContainer.View);
            itemDisappearingContainer.View.ItemDisappearing += (sender, args) => itemDisappearingContainer.EventFired();

            var itemSelectedContainer = new EventViewContainer <ListView>(Test.ListView.ItemSelected, new ListView());

            InitializeElement(itemSelectedContainer.View);
            itemSelectedContainer.View.ItemSelected += (sender, args) => itemSelectedContainer.EventFired();

            var itemTappedContainer = new EventViewContainer <ListView>(Test.ListView.ItemTapped, new ListView());

            InitializeElement(itemTappedContainer.View);
            itemTappedContainer.View.ItemTapped += (sender, args) => itemTappedContainer.EventFired();

            // TODO
            var rowHeightContainer = new ViewContainer <ListView>(Test.ListView.RowHeight, new ListView());

            InitializeElement(rowHeightContainer.View);

            var selectedItemContainer = new ViewContainer <ListView>(Test.ListView.SelectedItem, new ListView());

            InitializeElement(selectedItemContainer.View);
            selectedItemContainer.View.SelectedItem = viewModel.Employees[2];

            var fastScrollItemContainer = new ViewContainer <ListView>(Test.ListView.FastScroll, new ListView());

            InitializeElement(fastScrollItemContainer.View);
            fastScrollItemContainer.View.On <Android>().SetIsFastScrollEnabled(true);
            fastScrollItemContainer.View.ItemsSource = viewModel.CategorizedEmployees;

            var scrolledItemContainer = new ViewContainer <ListView>(Test.ListView.Scrolled, new ListView());

            InitializeElement(scrolledItemContainer.View);
            scrolledItemContainer.View.ItemsSource = viewModel.Employees;
            var scrollTitle = scrolledItemContainer.TitleLabel.Text;

            scrolledItemContainer.View.Scrolled += (sender, args) =>
            {
                scrolledItemContainer.TitleLabel.Text = $"{scrollTitle}; X={args.ScrollX};Y={args.ScrollY}";
            };

            var refreshControlColorContainer = new ViewContainer <ListView>(Test.ListView.RefreshControlColor, new ListView());

            InitializeElement(refreshControlColorContainer.View);
            refreshControlColorContainer.View.RefreshControlColor    = Color.Red;
            refreshControlColorContainer.View.IsPullToRefreshEnabled = true;
            refreshControlColorContainer.View.Refreshing            += async(object sender, EventArgs e) => {
                await Task.Delay(2000);

                refreshControlColorContainer.View.IsRefreshing = false;
            };
            refreshControlColorContainer.View.ItemsSource = viewModel.Employees;

            var scrollbarVisibilityContainer = new ViewContainer <ListView>(Test.ListView.ScrollBarVisibility, new ListView());

            InitializeElement(scrollbarVisibilityContainer.View);
            scrollbarVisibilityContainer.View.HorizontalScrollBarVisibility = ScrollBarVisibility.Never;
            scrollbarVisibilityContainer.View.VerticalScrollBarVisibility   = ScrollBarVisibility.Never;
            scrollbarVisibilityContainer.View.ItemsSource         = viewModel.CategorizedEmployees;
            scrollbarVisibilityContainer.View.IsGroupingEnabled   = true;
            scrollbarVisibilityContainer.View.GroupDisplayBinding = new Binding("Key");

            Add(groupDisplayBindingContainer);
            Add(groupHeaderTemplateContainer);
            Add(groupShortNameContainer);
            Add(hasUnevenRowsContainer);
            Add(isGroupingEnabledContainer);
            Add(itemAppearingContainer);
            Add(itemDisappearingContainer);
            Add(itemSelectedContainer);
            Add(itemTappedContainer);
            Add(rowHeightContainer);
            Add(selectedItemContainer);
            Add(fastScrollItemContainer);
            Add(scrolledItemContainer);
            Add(refreshControlColorContainer);
            Add(scrollbarVisibilityContainer);
        }
Exemplo n.º 10
0
        protected override void Build(StackLayout stackLayout)
        {
            base.Build(stackLayout);
            var placeholderContainer = new ViewContainer <SearchBar> (Test.SearchBar.PlaceHolder, new SearchBar {
                Placeholder = "Placeholder"
            });

            var searchButtonPressedContainer = new EventViewContainer <SearchBar> (Test.SearchBar.SearchButtonPressed, new SearchBar {
            });

            searchButtonPressedContainer.View.SearchButtonPressed += (sender, args) => searchButtonPressedContainer.EventFired();

            var searchCommandContainer = new ViewContainer <SearchBar> (Test.SearchBar.SearchCommand,
                                                                        new SearchBar {
                SearchCommand = new Command(async() => await DisplayAlert("Search command", "Fired", "Ok"))
            }
                                                                        );

            var textContainer = new ViewContainer <SearchBar> (Test.SearchBar.Text, new SearchBar {
                Text = "I am text"
            });

            var textChangedContainer = new EventViewContainer <SearchBar> (Test.SearchBar.TextChanged, new SearchBar {
                Placeholder = "I am text changed"
            });

            textChangedContainer.View.TextChanged += (sender, args) => textChangedContainer.EventFired();

            var cancelButtonColor = new ViewContainer <SearchBar> (
                Test.SearchBar.CancelButtonColor,
                new SearchBar {
                Placeholder       = "Should have a red cancel button",
                CancelButtonColor = Color.Red
            }
                );

            var textFontAttributesContainer = new ViewContainer <SearchBar> (Test.SearchBar.FontAttributes, new SearchBar {
                Text = "I have italic text", FontAttributes = FontAttributes.Italic
            });
            var textFamilyContainer1 = new ViewContainer <SearchBar> (Test.SearchBar.FontFamily, new SearchBar {
                Text = "I have Comic Sans text in Win & Android", FontFamily = "Comic Sans MS"
            });
            var textFamilyContainer2 = new ViewContainer <SearchBar> (Test.SearchBar.FontFamily, new SearchBar {
                Text = "I have bold Chalkboard text in iOS", FontFamily = "ChalkboardSE-Regular", FontAttributes = FontAttributes.Bold
            });
            var textFontSizeContainer = new ViewContainer <SearchBar> (Test.SearchBar.FontSize, new SearchBar {
                Text = "I have default size text"
            });
            var textFontSizeDefaultContainer = new ViewContainer <SearchBar> (Test.SearchBar.FontSize, new SearchBar {
                Text = "I also have default size text"
            });

            textFontSizeDefaultContainer.View.FontSize = Device.GetNamedSize(NamedSize.Default, textFontSizeDefaultContainer.View);
            var textFontSizeLargeContainer = new ViewContainer <SearchBar> (Test.SearchBar.FontSize, new SearchBar {
                Text = "I have size 48 (huge) text", FontSize = 48
            });

            var textAlignmentStartContainer = new ViewContainer <SearchBar> (Test.SearchBar.TextAlignmentStart,
                                                                             new SearchBar {
                Text = "I should be at the start", HorizontalTextAlignment = TextAlignment.Start
            });
            var textAlignmentCenterContainer = new ViewContainer <SearchBar> (Test.SearchBar.TextAlignmentCenter,
                                                                              new SearchBar {
                Text = "I should be centered", HorizontalTextAlignment = TextAlignment.Center
            });
            var textAlignmentEndContainer = new ViewContainer <SearchBar> (Test.SearchBar.TextAlignmentEnd,
                                                                           new SearchBar {
                Text = "I should be at the end", HorizontalTextAlignment = TextAlignment.End
            });

            var textVerticalAlignmentStartContainer = new ViewContainer <SearchBar>(Test.SearchBar.TextVerticalAlignmentStart,
                                                                                    new SearchBar {
                Text = "I should be at the start", VerticalTextAlignment = TextAlignment.Start
            });
            var textVerticalAlignmentCenterContainer = new ViewContainer <SearchBar>(Test.SearchBar.TextVerticalAlignmentCenter,
                                                                                     new SearchBar {
                Text = "I should be centered", VerticalTextAlignment = TextAlignment.Center
            });
            var textVerticalAlignmentEndContainer = new ViewContainer <SearchBar>(Test.SearchBar.TextVerticalAlignmentEnd,
                                                                                  new SearchBar {
                Text = "I should be at the end", VerticalTextAlignment = TextAlignment.End
            });

            var placeholderAlignmentStartContainer = new ViewContainer <SearchBar> (Test.SearchBar.PlaceholderAlignmentStart,
                                                                                    new SearchBar {
                Placeholder = "I should be at the start", HorizontalTextAlignment = TextAlignment.Start
            });
            var placeholderAlignmentCenterContainer = new ViewContainer <SearchBar> (Test.SearchBar.PlaceholderAlignmentCenter,
                                                                                     new SearchBar {
                Placeholder = "I should be centered", HorizontalTextAlignment = TextAlignment.Center
            });
            var placeholderAlignmentEndContainer = new ViewContainer <SearchBar> (Test.SearchBar.PlaceholderAlignmentEnd,
                                                                                  new SearchBar {
                Placeholder = "I should be at the end", HorizontalTextAlignment = TextAlignment.End
            });

            var placeholderVerticalAlignmentStartContainer = new ViewContainer <SearchBar>(Test.SearchBar.PlaceholderVerticalAlignmentStart,
                                                                                           new SearchBar {
                Placeholder = "I should be at the start", VerticalTextAlignment = TextAlignment.Start
            });
            var placeholderVerticalAlignmentCenterContainer = new ViewContainer <SearchBar>(Test.SearchBar.PlaceholderVerticalAlignmentCenter,
                                                                                            new SearchBar {
                Placeholder = "I should be centered", VerticalTextAlignment = TextAlignment.Center
            });
            var placeholderVerticalAlignmentEndContainer = new ViewContainer <SearchBar>(Test.SearchBar.PlaceholderVerticalAlignmentEnd,
                                                                                         new SearchBar {
                Placeholder = "I should be at the end", VerticalTextAlignment = TextAlignment.End
            });

            var textColorContainer = new ViewContainer <SearchBar> (Test.SearchBar.TextColor,
                                                                    new SearchBar {
                Text = "I should be red", TextColor = Color.Red
            });

            var placeholderColorContainer = new ViewContainer <SearchBar> (Test.SearchBar.PlaceholderColor,
                                                                           new SearchBar {
                Placeholder = "I should be red", PlaceholderColor = Color.Red
            });

            var keyboardContainer = new ViewContainer <SearchBar>(Test.InputView.Keyboard,
                                                                  new SearchBar {
                Keyboard = Keyboard.Numeric
            });

            var maxLengthContainer = new ViewContainer <SearchBar>(Test.InputView.MaxLength,
                                                                   new SearchBar {
                MaxLength = 3
            });

            Add(placeholderContainer);
            Add(searchButtonPressedContainer);
            Add(searchCommandContainer);
            Add(textContainer);
            Add(textChangedContainer);
            Add(textFontAttributesContainer);
            Add(textFamilyContainer1);
            Add(textFamilyContainer2);
            Add(textFontSizeContainer);
            Add(textFontSizeDefaultContainer);
            Add(textFontSizeLargeContainer);
            Add(cancelButtonColor);
            Add(textAlignmentStartContainer);
            Add(textAlignmentCenterContainer);
            Add(textAlignmentEndContainer);
            Add(placeholderAlignmentStartContainer);
            Add(placeholderAlignmentCenterContainer);
            Add(placeholderAlignmentEndContainer);
            Add(textVerticalAlignmentStartContainer);
            Add(textVerticalAlignmentCenterContainer);
            Add(textVerticalAlignmentEndContainer);
            Add(placeholderVerticalAlignmentStartContainer);
            Add(placeholderVerticalAlignmentCenterContainer);
            Add(placeholderVerticalAlignmentEndContainer);
            Add(textColorContainer);
            Add(placeholderColorContainer);
            Add(keyboardContainer);
            Add(maxLengthContainer);
        }
Exemplo n.º 11
0
 protected void Add(ViewContainer <T> viewContainer)
 {
     _viewContainers.Add(viewContainer);
     _picker.Items.Add(viewContainer.TitleLabel.Text);
 }
Exemplo n.º 12
0
        protected override void Build(StackLayout stackLayout)
        {
            base.Build(stackLayout);

            IsEnabledStateViewContainer.View.Clicked += (sender, args) => IsEnabledStateViewContainer.TitleLabel.Text += " (Tapped)";

            var borderButtonContainer = new ViewContainer <Button> (Test.Button.BorderColor,
                                                                    new Button {
                Text            = "BorderColor",
                BackgroundColor = Color.Transparent,
                BorderColor     = Color.Red,
                BorderWidth     = 1,
            }
                                                                    );

            var borderRadiusContainer = new ViewContainer <Button> (Test.Button.BorderRadius,
                                                                    new Button {
                Text            = "BorderRadius",
                BackgroundColor = Color.Transparent,
                BorderColor     = Color.Red,
#pragma warning disable 0618
                BorderRadius = 20,
#pragma warning restore
                BorderWidth = 1,
            }
                                                                    );

            var borderWidthContainer = new ViewContainer <Button> (Test.Button.BorderWidth,
                                                                   new Button {
                Text            = "BorderWidth",
                BackgroundColor = Color.Transparent,
                BorderColor     = Color.Red,
                BorderWidth     = 15,
            }
                                                                   );

            var clickedContainer = new EventViewContainer <Button> (Test.Button.Clicked,
                                                                    new Button {
                Text = "Clicked"
            }
                                                                    );

            clickedContainer.View.Clicked += (sender, args) => clickedContainer.EventFired();

            var pressedContainer = new EventViewContainer <Button>(Test.Button.Pressed,
                                                                   new Button
            {
                Text = "Pressed"
            }
                                                                   );

            pressedContainer.View.Pressed += (sender, args) => pressedContainer.EventFired();

            var commandContainer = new ViewContainer <Button> (Test.Button.Command,
                                                               new Button {
                Text    = "Command",
                Command = new Command(() => DisplayActionSheet("Hello Command", "Cancel", "Destroy"))
            }
                                                               );

            var fontContainer = new ViewContainer <Button> (Test.Button.Font,
                                                            new Button {
                Text = "Font",
                Font = Font.SystemFontOfSize(NamedSize.Large, FontAttributes.Bold)
            }
                                                            );

            var imageContainer = new ViewContainer <Button> (Test.Button.Image,
                                                             new Button {
                Text        = "Image",
                ImageSource = new FileImageSource {
                    File = "bank.png"
                }
            }
                                                             )
            ;
            var textContainer = new ViewContainer <Button> (Test.Button.Text,
                                                            new Button {
                Text = "Text"
            }
                                                            );

            var textColorContainer = new ViewContainer <Button> (Test.Button.TextColor,
                                                                 new Button {
                Text = "TextColor", TextColor = Color.Pink
            }
                                                                 );

            var paddingContainer = new ViewContainer <Button> (Test.Button.Padding,
                                                               new Button {
                Text = "Padding", BackgroundColor = Color.Red, Padding = new Thickness(20, 30, 60, 15)
            }
                                                               );

            Add(borderButtonContainer);
            Add(borderRadiusContainer);
            Add(borderWidthContainer);
            Add(clickedContainer);
            Add(pressedContainer);
            Add(commandContainer);
            Add(fontContainer);
            Add(imageContainer);
            Add(textContainer);
            Add(textColorContainer);
            Add(paddingContainer);
            //stackLayout.Children.Add (textColorContainer);
        }
Exemplo n.º 13
0
        protected override void Build(StackLayout stackLayout)
        {
            base.Build(stackLayout);


            IsEnabledStateViewContainer.View.Clicked += (sender, args) =>
            {
                IsEnabledStateViewContainer.TitleLabel.Text += " (Tapped)";
            };

            var aspectFillContainer = new ViewContainer <ImageButton>(Test.ImageButton.AspectFill, new ImageButton {
                Aspect = Aspect.AspectFill
            });
            var aspectFitContainer = new ViewContainer <ImageButton>(Test.ImageButton.AspectFit, new ImageButton {
                Aspect = Aspect.AspectFit
            });
            var fillContainer = new ViewContainer <ImageButton>(Test.ImageButton.Fill, new ImageButton {
                Aspect = Aspect.Fill
            });
            var isLoadingContainer = new StateViewContainer <ImageButton>(Test.ImageButton.IsLoading, new ImageButton());
            var isOpaqueContainer  = new StateViewContainer <ImageButton>(Test.ImageButton.IsOpaque, new ImageButton());


            var borderButtonContainer = new ViewContainer <ImageButton>(Test.ImageButton.BorderColor,
                                                                        new ImageButton
            {
                BackgroundColor = Color.Transparent,
                BorderColor     = Color.Red,
                BorderWidth     = 1,
                Source          = "oasissmall.jpg"
            }
                                                                        );

            var corderRadiusContainer = new ViewContainer <ImageButton>(Test.ImageButton.CornerRadius,
                                                                        new ImageButton
            {
                Source          = "oasissmall.jpg",
                BackgroundColor = Color.Transparent,
                BorderColor     = Color.Red,
                CornerRadius    = 20,
                BorderWidth     = 1,
            }
                                                                        );

            var borderWidthContainer = new ViewContainer <ImageButton>(Test.ImageButton.BorderWidth,
                                                                       new ImageButton
            {
                Source          = "oasissmall.jpg",
                BackgroundColor = Color.Transparent,
                BorderColor     = Color.Red,
                BorderWidth     = 15,
            }
                                                                       );

            var clickedContainer = new EventViewContainer <ImageButton>(Test.ImageButton.Clicked,
                                                                        new ImageButton
            {
                Source = "oasissmall.jpg"
            }
                                                                        );

            clickedContainer.View.Clicked += (sender, args) => clickedContainer.EventFired();

            var pressedContainer = new EventViewContainer <ImageButton>(Test.ImageButton.Pressed,
                                                                        new ImageButton
            {
                Source = "oasissmall.jpg"
            }
                                                                        );

            pressedContainer.View.Pressed += (sender, args) => pressedContainer.EventFired();

            var commandContainer = new ViewContainer <ImageButton>(Test.ImageButton.Command,
                                                                   new ImageButton
            {
                Command = new Command(() => DisplayActionSheet("Hello Command", "Cancel", "Destroy")),
                Source  = "oasissmall.jpg"
            }
                                                                   );

            var imageContainer = new ViewContainer <ImageButton>(Test.ImageButton.Image,
                                                                 new ImageButton
            {
                Source = new FileImageSource {
                    File = "bank.png"
                }
            }
                                                                 );

            var paddingContainer = new ViewContainer <ImageButton>(Test.ImageButton.Padding,
                                                                   new ImageButton
            {
                Source          = "oasissmall.jpg",
                BackgroundColor = Color.Red,
                Padding         = new Thickness(20, 30, 60, 15)
            }
                                                                   );


            InitializeElement(aspectFillContainer.View);
            InitializeElement(aspectFitContainer.View);
            InitializeElement(fillContainer.View);
            InitializeElement(isLoadingContainer.View);
            InitializeElement(isOpaqueContainer.View);

            var sourceContainer = new ViewContainer <ImageButton>(Test.ImageButton.Source, new ImageButton {
                Source = "https://raw.githubusercontent.com/xamarin/System.Maui/master/System.Maui.Controls/coffee.png"
            });

            var gifContainer = new ViewContainer <ImageButton>(Test.ImageButton.Source, new ImageButton {
                Source = "GifTwo.gif"
            });

            Add(aspectFillContainer);
            Add(aspectFitContainer);
            Add(fillContainer);
            Add(isLoadingContainer);
            Add(isOpaqueContainer);
            Add(sourceContainer);
            Add(gifContainer);

            Add(borderButtonContainer);
            Add(borderWidthContainer);
            Add(clickedContainer);
            Add(commandContainer);
            Add(corderRadiusContainer);
            Add(imageContainer);
            Add(pressedContainer);
            Add(paddingContainer);
        }
Exemplo n.º 14
0
        protected override void Build(StackLayout stackLayout)
        {
            base.Build(stackLayout);
            var itemsContainer = new ViewContainer <Picker>(Test.Picker.Items, new Picker());

            itemsContainer.View.Items.Add("Item 1");
            itemsContainer.View.Items.Add("Item 2");
            itemsContainer.View.Items.Add("Item 3");

            var selectedIndexContainer = new ViewContainer <Picker>(Test.Picker.SelectedIndex, new Picker());

            selectedIndexContainer.View.Items.Add("Item 1");
            selectedIndexContainer.View.Items.Add("Item 2");
            selectedIndexContainer.View.Items.Add("Item 3");
            selectedIndexContainer.View.SelectedIndex = 2;

            var titleContainer = new ViewContainer <Picker>(Test.Picker.Title, new Picker());

            titleContainer.View.Title = "Title";

            var titleColorContainer = new ViewContainer <Picker>(Test.Picker.TitleColor, new Picker());

            titleColorContainer.View.Title      = "Title Color";
            titleColorContainer.View.TitleColor = Color.Red;

            var buttonReset = new Button()
            {
                Text = "Reset color to default"
            };
            var buttonChange = new Button()
            {
                Text = "Change color"
            };

            buttonReset.Clicked  += (o, a) => titleColorContainer.View.ClearValue(Picker.TitleColorProperty);
            buttonChange.Clicked += (o, a) => titleColorContainer.View.TitleColor = Color.Green;

            titleColorContainer.ContainerLayout.Children.Add(buttonReset);
            titleColorContainer.ContainerLayout.Children.Add(buttonChange);

            var textColorContainer = new ViewContainer <Picker>(Test.Picker.TextColor, new Picker());

            textColorContainer.View.Items.Add("Item 1");
            textColorContainer.View.Items.Add("Item 2");
            textColorContainer.View.Items.Add("Item 3");

            var fontAttributesContainer = new ViewContainer <Picker>(Test.Picker.FontAttributes,
                                                                     new Picker {
                FontAttributes = FontAttributes.Bold
            });

            fontAttributesContainer.View.Items.Add("Item 1");
            fontAttributesContainer.View.Items.Add("Item 2");
            fontAttributesContainer.View.Items.Add("Item 3");

            var fontFamilyContainer = new ViewContainer <Picker>(Test.Picker.FontFamily,
                                                                 new Picker());

            // Set font family based on available fonts per platform
            switch (Device.RuntimePlatform)
            {
            case Device.Android:
                fontFamilyContainer.View.FontFamily = "sans-serif-thin";
                break;

            case Device.iOS:
                fontFamilyContainer.View.FontFamily = "Courier";
                break;

            default:
                fontFamilyContainer.View.FontFamily = "Garamond";
                break;
            }
            fontFamilyContainer.View.Items.Add("Item 1");
            fontFamilyContainer.View.Items.Add("Item 2");
            fontFamilyContainer.View.Items.Add("Item 3");

            var fontSizeContainer = new ViewContainer <Picker>(Test.Picker.FontSize,
                                                               new Picker {
                FontSize = 24
            });

            fontSizeContainer.View.Items.Add("Item 1");
            fontSizeContainer.View.Items.Add("Item 2");
            fontSizeContainer.View.Items.Add("Item 3");

            Add(itemsContainer);
            Add(selectedIndexContainer);
            Add(titleContainer);
            Add(titleColorContainer);
            Add(textColorContainer);
            Add(fontAttributesContainer);
            Add(fontFamilyContainer);
            Add(fontSizeContainer);
        }
Exemplo n.º 15
0
        protected override void Build(StackLayout stackLayout)
        {
            base.Build(stackLayout);

            IsEnabledStateViewContainer.View.Clicked += (sender, args) => IsEnabledStateViewContainer.TitleLabel.Text += " (Tapped)";

            var borderButtonContainer = new ViewContainer <RadioButton>(Test.Button.BorderColor,
                                                                        new RadioButton
            {
                Text            = "BorderColor",
                BackgroundColor = Color.Transparent,
                BorderColor     = Color.Red,
                BorderWidth     = 1,
            }
                                                                        );

            var borderRadiusContainer = new ViewContainer <RadioButton>(Test.Button.BorderRadius,
                                                                        new RadioButton
            {
                Text            = "BorderRadius",
                BackgroundColor = Color.Transparent,
                BorderColor     = Color.Red,
                BorderWidth     = 1,
            }
                                                                        );

            var borderWidthContainer = new ViewContainer <RadioButton>(Test.Button.BorderWidth,
                                                                       new RadioButton
            {
                Text            = "BorderWidth",
                BackgroundColor = Color.Transparent,
                BorderColor     = Color.Red,
                BorderWidth     = 15,
            }
                                                                       );

            var clickedContainer = new EventViewContainer <RadioButton>(Test.Button.Clicked,
                                                                        new RadioButton
            {
                Text = "Clicked"
            }
                                                                        );

            clickedContainer.View.Clicked += (sender, args) => clickedContainer.EventFired();

            var pressedContainer = new EventViewContainer <RadioButton>(Test.Button.Pressed,
                                                                        new RadioButton
            {
                Text = "Pressed"
            }
                                                                        );

            pressedContainer.View.Pressed += (sender, args) => pressedContainer.EventFired();

            var commandContainer = new ViewContainer <RadioButton>(Test.Button.Command,
                                                                   new RadioButton
            {
                Text    = "Command",
                Command = new Command(() => DisplayActionSheet("Hello Command", "Cancel", "Destroy"))
            }
                                                                   );

            var fontContainer = new ViewContainer <RadioButton>(Test.Button.Font,
                                                                new RadioButton
            {
                Text = "Font",
                Font = Font.SystemFontOfSize(NamedSize.Large, FontAttributes.Bold)
            }
                                                                );

            var textContainer = new ViewContainer <RadioButton>(Test.Button.Text,
                                                                new RadioButton
            {
                Text = "Text"
            }
                                                                );

            var textColorContainer = new ViewContainer <RadioButton>(Test.Button.TextColor,
                                                                     new RadioButton
            {
                Text      = "TextColor",
                TextColor = Color.Pink
            }
                                                                     );

            var paddingContainer = new ViewContainer <RadioButton>(Test.Button.Padding,
                                                                   new RadioButton
            {
                Text            = "Padding",
                BackgroundColor = Color.Red,
                Padding         = new Thickness(20, 30, 60, 15)
            }
                                                                   );

            var isCheckedContainer = new ValueViewContainer <RadioButton>(Test.RadioButton.IsChecked, new RadioButton()
            {
                IsChecked = true, HorizontalOptions = LayoutOptions.Start
            }, "IsChecked", value => value.ToString());

            //var checkedVisualState = new VisualState { Name = "IsChecked" };
            //checkedVisualState.Setters.Add(new Setter { Property = RadioButton.ButtonSourceProperty, Value = "rb_checked" });

            //var group = new VisualStateGroup();
            //group.States.Add(checkedVisualState);

            //var normalVisualState = new VisualState{  Name = "Normal" };
            //normalVisualState.Setters.Add(new Setter { Property = RadioButton.ButtonSourceProperty, Value = "rb_unchecked" });
            //group.States.Add(normalVisualState);

            //var groupList = new VisualStateGroupList();
            //groupList.Add(group);

            //var rbStateManaged = new RadioButton() { HorizontalOptions = LayoutOptions.Start };
            //VisualStateManager.SetVisualStateGroups(rbStateManaged, groupList);

            //var stateManagedContainer = new ValueViewContainer<RadioButton>(Test.RadioButton.ButtonSource, rbStateManaged, "IsChecked", value => value.ToString());

            Add(borderButtonContainer);
            Add(borderRadiusContainer);
            Add(borderWidthContainer);
            Add(clickedContainer);
            Add(pressedContainer);
            Add(commandContainer);
            Add(fontContainer);
            Add(textContainer);
            Add(textColorContainer);
            Add(paddingContainer);
            Add(isCheckedContainer);
            //Add(stateManagedContainer);
        }
Exemplo n.º 16
0
        protected override void Build(StackLayout stackLayout)
        {
            base.Build(stackLayout);

            var urlWebViewSourceContainer = new ViewContainer <WebView> (Test.WebView.UrlWebViewSource,
                                                                         new WebView {
                Source = new UrlWebViewSource {
                    Url = "https://www.google.com/"
                },
                HeightRequest = 200
            }
                                                                         );

            const string html = "<!DOCTYPE html><html>" +
                                "<head><meta name='viewport' content='width=device-width,initial-scale=1.0'></head>" +
                                "<body><div class=\"test\"><h2>I am raw html</h2></div></body></html>";

            var htmlWebViewSourceContainer = new ViewContainer <WebView> (Test.WebView.HtmlWebViewSource,
                                                                          new WebView {
                Source = new HtmlWebViewSource {
                    Html = html
                },
                HeightRequest = 200
            }
                                                                          );

            var htmlFileWebSourceContainer = new ViewContainer <WebView> (Test.WebView.LoadHtml,
                                                                          new WebView {
                Source = new HtmlWebViewSource
                {
                    Html = @"<!DOCTYPE html><html>
<head>
<meta name='viewport' content='width=device-width,initial-scale=1.0'>
<link rel=""stylesheet"" href=""default.css"">
</head>
<body>
<h1>System.Maui</h1>
<p>The CSS and image are loaded from local files!</p>
<img src='WebImages/XamarinLogo.png'/>
<p><a href=""local.html"">next page</a></p>
</body>
</html>"
                },
                HeightRequest = 200
            }
                                                                          );

            // NOTE: Currently the ability to programmatically enable/disable mixed content only exists on Android
            // NOTE: Currently the ability to programmatically enable/disable zoom only exists on Android
            if (Device.RuntimePlatform == Device.Android)
            {
                var mixedContentTestPage = "https://mixed-content-test.appspot.com/";

                var mixedContentDisallowedWebView = new WebView()
                {
                    HeightRequest = 1000
                };
                mixedContentDisallowedWebView.On <Android>().SetMixedContentMode(MixedContentHandling.NeverAllow);
                mixedContentDisallowedWebView.Source = new UrlWebViewSource
                {
                    Url = mixedContentTestPage
                };

                var mixedContentAllowedWebView = new WebView()
                {
                    HeightRequest = 1000
                };
                mixedContentAllowedWebView.On <Android>().SetMixedContentMode(MixedContentHandling.AlwaysAllow);
                mixedContentAllowedWebView.Source = new UrlWebViewSource
                {
                    Url = mixedContentTestPage
                };

                var enableZoomControlsWebView = new WebView()
                {
                    HeightRequest = 200
                };
                enableZoomControlsWebView.On <Android>().SetEnableZoomControls(true);
                enableZoomControlsWebView.On <Android>().SetDisplayZoomControls(false);
                enableZoomControlsWebView.Source = new UrlWebViewSource
                {
                    Url = "https://www.xamarin.com"
                };

                var displayZoomControlsWebView = new WebView()
                {
                    HeightRequest = 200
                };
                displayZoomControlsWebView.On <Android>().SetEnableZoomControls(true);
                displayZoomControlsWebView.On <Android>().SetDisplayZoomControls(true);
                displayZoomControlsWebView.Source = new UrlWebViewSource
                {
                    Url = "https://www.xamarin.com"
                };

                var mixedContentDisallowedContainer = new ViewContainer <WebView>(Test.WebView.MixedContentDisallowed,
                                                                                  mixedContentDisallowedWebView);
                var mixedContentAllowedContainer = new ViewContainer <WebView>(Test.WebView.MixedContentAllowed,
                                                                               mixedContentAllowedWebView);

                var enableZoomControlsContainer = new ViewContainer <WebView>(Test.WebView.EnableZoomControls,
                                                                              enableZoomControlsWebView);
                var displayZoomControlsWebViewContainer = new ViewContainer <WebView>(Test.WebView.DisplayZoomControls,
                                                                                      displayZoomControlsWebView);

                Add(mixedContentDisallowedContainer);
                Add(mixedContentAllowedContainer);
                Add(enableZoomControlsContainer);
                Add(displayZoomControlsWebViewContainer);
            }


            var jsAlertWebView = new WebView
            {
                Source = new HtmlWebViewSource
                {
                    Html = @"<!DOCTYPE html><html>
<head>
<meta name='viewport' content='width=device-width,initial-scale=1.0'>
<link rel=""stylesheet"" href=""default.css"">
</head>
<body>
<button onclick=""window.alert('foo');"">Click</button>
</body>
</html>"
                },
                HeightRequest = 200
            };

            jsAlertWebView.On <WindowsOS>().SetIsJavaScriptAlertEnabled(true);

            var javascriptAlertWebSourceContainer = new ViewContainer <WebView>(Test.WebView.JavaScriptAlert,
                                                                                jsAlertWebView
                                                                                );

            var evaluateJsWebView = new WebView
            {
                Source = new UrlWebViewSource {
                    Url = "https://www.google.com/"
                },
                HeightRequest = 50
            };
            var evaluateJsWebViewSourceContainer = new ViewContainer <WebView>(Test.WebView.EvaluateJavaScript,
                                                                               evaluateJsWebView
                                                                               );

            var resultsLabel = new Label();
            var execButton   = new Button();

            execButton.Text    = "Evaluate Javascript";
            execButton.Command = new Command(async() => resultsLabel.Text = await evaluateJsWebView.EvaluateJavaScriptAsync(
                                                 "var test = function(){ return 'This string came from Javascript!'; }; test();"));

            evaluateJsWebViewSourceContainer.ContainerLayout.Children.Add(resultsLabel);
            evaluateJsWebViewSourceContainer.ContainerLayout.Children.Add(execButton);


            Add(urlWebViewSourceContainer);
            Add(htmlWebViewSourceContainer);
            Add(htmlFileWebSourceContainer);
            Add(javascriptAlertWebSourceContainer);
            Add(evaluateJsWebViewSourceContainer);
        }
Exemplo n.º 17
0
        protected override void Build(StackLayout stackLayout)
        {
            base.Build(stackLayout);

            var completedContainer = new EventViewContainer <Editor>(Test.Editor.Completed, new Editor());

            completedContainer.View.Completed += (sender, args) => completedContainer.EventFired();

            var textContainer = new ViewContainer <Editor>(Test.Editor.Text, new Editor {
                Text = "I have text"
            });

            var textChangedContainer = new EventViewContainer <Editor>(Test.Editor.TextChanged, new Editor());

            textChangedContainer.View.TextChanged += (sender, args) => textChangedContainer.EventFired();
            var placeholderContainer = new ViewContainer <Editor>(Test.Editor.Placeholder, new Editor {
                Placeholder = "Placeholder"
            });

            var placeholderColorContainer = new ViewContainer <Editor>(Test.Editor.PlaceholderColor, new Editor {
                Placeholder = "I should have red placeholder", PlaceholderColor = Color.Red
            });
            var textFontAttributesContainer = new ViewContainer <Editor>(Test.Editor.FontAttributes, new Editor {
                Text = "I have italic text", FontAttributes = FontAttributes.Italic
            });
            var textFamilyContainer1 = new ViewContainer <Editor>(Test.Editor.FontFamily, new Editor {
                Text = "I have Comic Sans text in Win & Android", FontFamily = "Comic Sans MS"
            });
            var textFamilyContainer2 = new ViewContainer <Editor>(Test.Editor.FontFamily, new Editor {
                Text = "I have bold Chalkboard text in iOS", FontFamily = "ChalkboardSE-Regular", FontAttributes = FontAttributes.Bold
            });
            var textFontSizeContainer = new ViewContainer <Editor>(Test.Editor.FontSize, new Editor {
                Text = "I have default size text"
            });
            var textFontSizeDefaultContainer = new ViewContainer <Editor>(Test.Editor.FontSize, new Editor {
                Text = "I also have default size text"
            });

            textFontSizeDefaultContainer.View.FontSize = Device.GetNamedSize(NamedSize.Default, textFontSizeDefaultContainer.View);
            var textFontSizeLargeContainer = new ViewContainer <Editor>(Test.Editor.FontSize, new Editor {
                Text = "I have size 48 (huge) text", FontSize = 48
            });

            var textColorContainer = new ViewContainer <Editor>(Test.Editor.TextColor,
                                                                new Editor {
                Text = "I should have red text", TextColor = Color.Red
            });

            var textColorDisabledContainer = new ViewContainer <Editor>(Test.Editor.TextColor,
                                                                        new Editor {
                Text = "I should have the default disabled text color", TextColor = Color.Red, IsEnabled = false
            });

            var keyboardContainer = new ViewContainer <Editor>(Test.InputView.Keyboard,
                                                               new Editor {
                Keyboard = Keyboard.Numeric
            });

            var maxLengthContainer = new ViewContainer <Editor>(Test.InputView.MaxLength, new Editor {
                MaxLength = 3
            });

            var readOnlyContainer = new ViewContainer <Editor>(Test.Editor.IsReadOnly, new Editor {
                Text = "This is read-only Editor", IsReadOnly = true
            });

            Add(completedContainer);
            Add(textContainer);
            Add(textChangedContainer);
            Add(placeholderContainer);
            Add(placeholderColorContainer);
            Add(textFontAttributesContainer);
            Add(textFamilyContainer1);
            Add(textFamilyContainer2);
            Add(textFontSizeContainer);
            Add(textFontSizeDefaultContainer);
            Add(textFontSizeLargeContainer);
            Add(textColorContainer);
            Add(textColorDisabledContainer);
            Add(keyboardContainer);
            Add(maxLengthContainer);
            Add(readOnlyContainer);
        }
Exemplo n.º 18
0
        protected override void Build(StackLayout stackLayout)
        {
            base.Build(stackLayout);

#pragma warning disable 618
            var namedSizeMediumBoldContainer = new ViewContainer <Label> (Test.Label.FontAttibutesBold, new Label {
                Text = "Medium Bold Font", Font = Font.SystemFontOfSize(NamedSize.Medium, FontAttributes.Bold)
            });
#pragma warning restore 618

#pragma warning disable 618
            var namedSizeMediumItalicContainer = new ViewContainer <Label> (Test.Label.FontAttributesItalic, new Label {
                Text = "Medium Italic Font", Font = Font.SystemFontOfSize(NamedSize.Medium, FontAttributes.Italic)
            });
#pragma warning restore 618

#pragma warning disable 618
            var namedSizeMediumUnderlineContainer = new ViewContainer <Label>(Test.Label.TextDecorationUnderline, new Label {
                Text = "Medium Underlined Font", Font = Font.SystemFontOfSize(NamedSize.Medium), TextDecorations = TextDecorations.Underline
            });
#pragma warning restore 618

#pragma warning disable 618
            var namedSizeMediumStrikeContainer = new ViewContainer <Label>(Test.Label.TextDecorationStrike, new Label {
                Text = "Medium StrikeThrough Font", Font = Font.SystemFontOfSize(NamedSize.Medium), TextDecorations = TextDecorations.Strikethrough
            });
#pragma warning restore 618

#pragma warning disable 618
            var namedSizeLargeContainer = new ViewContainer <Label> (Test.Label.FontNamedSizeLarge, new Label {
                Text = "Large Font", Font = Font.SystemFontOfSize(NamedSize.Large)
            });
#pragma warning restore 618

#pragma warning disable 618
            var namedSizeMediumContainer = new ViewContainer <Label> (Test.Label.FontNamedSizeMedium, new Label {
                Text = "Medium Font", Font = Font.SystemFontOfSize(NamedSize.Medium)
            });
#pragma warning restore 618

#pragma warning disable 618
            var namedSizeMicroContainer = new ViewContainer <Label> (Test.Label.FontNamedSizeMicro, new Label {
                Text = "Micro Font", Font = Font.SystemFontOfSize(NamedSize.Micro)
            });
#pragma warning restore 618

#pragma warning disable 618
            var namedSizeSmallContainer = new ViewContainer <Label> (Test.Label.FontNamedSizeSmall, new Label {
                Text = "Small Font", Font = Font.SystemFontOfSize(NamedSize.Small)
            });
#pragma warning restore 618

            var formattedString = new FormattedString();
            formattedString.Spans.Add(new Span {
                BackgroundColor = Color.Red, TextColor = Color.Olive, Text = "Span 1 "
            });

            Span span = new Span {
                BackgroundColor = Color.Black, TextColor = Color.White, Text = "Span 2 (tap me) "
            };
            span.GestureRecognizers.Add(new TapGestureRecognizer {
                Command = new Command(() => DisplayAlert("Congratulations!", "This is a tapped span", "ok"))
            });
            formattedString.Spans.Add(span);

            formattedString.Spans.Add(new Span {
                BackgroundColor = Color.Pink, TextColor = Color.Purple, Text = "Span 3"
            });

            var formattedTextContainer = new ViewContainer <Label>(Test.Label.FormattedText, new Label {
                FormattedText = formattedString
            });

            const string longText = "Lorem ipsum dolor sit amet, cu mei malis petentium, dolor tempor delicata no qui, eos ex vitae utinam vituperata. Utroque habemus philosophia ut mei, doctus placerat eam cu. An inermis scaevola pro, quo legimus deleniti ei, equidem docendi urbanitas ea eum. Saepe doctus ut pri. Nec ex wisi dolorem. Duo dolor vituperatoribus ea. Id purto instructior per. Nec partem accusamus ne. Qui ad saepe accumsan appellantur, duis omnesque has et, vim nihil nemore scaevola ne. Ei populo appetere recteque xum, meliore splendide appellantur vix id.";
            var          lineBreakModeCharacterWrapContainer = new ViewContainer <Label> (Test.Label.LineBreakModeCharacterWrap, new Label {
                Text = longText, LineBreakMode = LineBreakMode.CharacterWrap
            });
            var lineBreakModeHeadTruncationContainer = new ViewContainer <Label> (Test.Label.LineBreakModeHeadTruncation, new Label {
                Text = longText, LineBreakMode = LineBreakMode.HeadTruncation
            });
            var lineBreakModeMiddleTruncationContainer = new ViewContainer <Label> (Test.Label.LineBreakModeMiddleTruncation, new Label {
                Text = longText, LineBreakMode = LineBreakMode.MiddleTruncation
            });
            var lineBreakModeNoWrapContainer = new ViewContainer <Label> (Test.Label.LineBreakModeNoWrap, new Label {
                Text = longText, LineBreakMode = LineBreakMode.NoWrap
            });
            var lineBreakModeTailTruncationContainer = new ViewContainer <Label> (Test.Label.LineBreakModeTailTruncation, new Label {
                Text = longText, LineBreakMode = LineBreakMode.TailTruncation
            });
            var lineBreakModeWordWrapContainer = new ViewContainer <Label> (Test.Label.LineBreakModeWordWrap, new Label {
                Text = longText, LineBreakMode = LineBreakMode.WordWrap
            });

            var textContainer = new ViewContainer <Label> (Test.Label.Text, new Label {
                Text = "I should have text"
            });
            var textColorContainer = new ViewContainer <Label> (Test.Label.TextColor, new Label {
                Text = "I should have lime text", TextColor = Color.Lime
            });

            const int alignmentTestsHeightRequest = 100;
            const int alignmentTestsWidthRequest  = 100;

            var xAlignCenterContainer = new ViewContainer <Label> (Test.Label.HorizontalTextAlignmentCenter,
                                                                   new Label {
                Text = "HorizontalTextAlignment Center",
                HorizontalTextAlignment = TextAlignment.Center,
                HeightRequest           = alignmentTestsHeightRequest,
                WidthRequest            = alignmentTestsWidthRequest
            }
                                                                   );

            var xAlignEndContainer = new ViewContainer <Label> (Test.Label.HorizontalTextAlignmentEnd,
                                                                new Label {
                Text = "HorizontalTextAlignment End",
                HorizontalTextAlignment = TextAlignment.End,
                HeightRequest           = alignmentTestsHeightRequest,
                WidthRequest            = alignmentTestsWidthRequest
            }
                                                                );

            var xAlignStartContainer = new ViewContainer <Label> (Test.Label.HorizontalTextAlignmentStart,
                                                                  new Label {
                Text = "HorizontalTextAlignment Start",
                HorizontalTextAlignment = TextAlignment.Start,
                HeightRequest           = alignmentTestsHeightRequest,
                WidthRequest            = alignmentTestsWidthRequest
            }
                                                                  );

            var yAlignCenterContainer = new ViewContainer <Label> (Test.Label.VerticalTextAlignmentCenter,
                                                                   new Label {
                Text = "VerticalTextAlignment Start",
                VerticalTextAlignment = TextAlignment.Center,
                HeightRequest         = alignmentTestsHeightRequest,
                WidthRequest          = alignmentTestsWidthRequest,
                BackgroundColor       = Color.Pink
            }
                                                                   );

            var yAlignEndContainer = new ViewContainer <Label> (Test.Label.VerticalTextAlignmentEnd,
                                                                new Label {
                Text = "VerticalTextAlignment End",
                VerticalTextAlignment = TextAlignment.End,
                HeightRequest         = alignmentTestsHeightRequest,
                WidthRequest          = alignmentTestsWidthRequest,
                BackgroundColor       = Color.Pink
            }
                                                                );

            var yAlignStartContainer = new ViewContainer <Label> (Test.Label.VerticalTextAlignmentStart,
                                                                  new Label {
                Text = "VerticalTextAlignment Start",
                VerticalTextAlignment = TextAlignment.Start,
                HeightRequest         = alignmentTestsHeightRequest,
                WidthRequest          = alignmentTestsWidthRequest,
                BackgroundColor       = Color.Pink
            }
                                                                  );

            var styleTitleContainer = new ViewContainer <Label> (Test.Device.Styles,
                                                                 new Label {
                Text  = "Device.Styles.TitleStyle",
                Style = Device.Styles.TitleStyle
            }
                                                                 );

            var styleSubtitleContainer = new ViewContainer <Label> (Test.Device.Styles,
                                                                    new Label {
                Text  = "Device.Styles.SubtitleStyle",
                Style = Device.Styles.SubtitleStyle
            }
                                                                    );

            var styleBodyContainer = new ViewContainer <Label> (Test.Device.Styles,
                                                                new Label {
                Text  = "Device.Styles.BodyStyle",
                Style = Device.Styles.BodyStyle
            }
                                                                );

            var styleCaptionContainer = new ViewContainer <Label> (Test.Device.Styles,
                                                                   new Label {
                Text  = "Device.Styles.CaptionStyle",
                Style = Device.Styles.CaptionStyle,
            }
                                                                   );

            var maxlinesContainer = new ViewContainer <Label>(Test.Label.MaxLines,
                                                              new Label {
                Text     = longText,
                MaxLines = 2
            }
                                                              );

            var maxlinesCharWrapContainer = new ViewContainer <Label>(Test.Label.MaxLines,
                                                                      new Label
            {
                Text          = longText,
                MaxLines      = 2,
                LineBreakMode = LineBreakMode.CharacterWrap
            }
                                                                      );

            var maxlinesHeadTruncContainer = new ViewContainer <Label>(Test.Label.MaxLines,
                                                                       new Label
            {
                Text          = longText,
                MaxLines      = 2,
                LineBreakMode = LineBreakMode.HeadTruncation
            }
                                                                       );

            var maxlinesMiddleTruncContainer = new ViewContainer <Label>(Test.Label.MaxLines,
                                                                         new Label
            {
                Text          = longText,
                MaxLines      = 2,
                LineBreakMode = LineBreakMode.MiddleTruncation
            }
                                                                         );

            var maxlinesNoWrapContainer = new ViewContainer <Label>(Test.Label.MaxLines,
                                                                    new Label
            {
                Text          = longText,
                MaxLines      = 2,
                LineBreakMode = LineBreakMode.NoWrap
            }
                                                                    );

            var maxlinesTailTruncContainer = new ViewContainer <Label>(Test.Label.MaxLines,
                                                                       new Label
            {
                Text          = longText,
                MaxLines      = 2,
                LineBreakMode = LineBreakMode.TailTruncation
            }
                                                                       );

            var maxlinesWordWrapContainer = new ViewContainer <Label>(Test.Label.MaxLines,
                                                                      new Label
            {
                Text          = longText,
                MaxLines      = 2,
                LineBreakMode = LineBreakMode.WordWrap
            }
                                                                      );

            var formattedString2 = new FormattedString();
            formattedString2.Spans.Add(new Span {
                BackgroundColor = Color.Red, TextColor = Color.Olive, Text = "Span 1 "
            });
            var span2 = new Span {
                BackgroundColor = Color.Black, TextColor = Color.White, Text = "Span 2 (tap me) "
            };
            span2.GestureRecognizers.Add(new TapGestureRecognizer {
                Command = new Command(() => DisplayAlert("Congratulations!", "This is a tapped span", "ok"))
            });
            formattedString2.Spans.Add(span2);
            formattedString2.Spans.Add(new Span {
                BackgroundColor = Color.Pink, TextColor = Color.Purple, Text = "Span 3"
            });

            var paddingContainer = new ViewContainer <Label>(Test.Label.Padding,
                                                             new Label
            {
                FormattedText   = formattedString2,
                BackgroundColor = Color.Yellow,
                Padding         = new Thickness(40, 20)
            }
                                                             );

            var htmlLabelContainer = new ViewContainer <Label>(Test.Label.HtmlTextType,
                                                               new Label
            {
                Text     = "<h1>Hello world!</h1>",
                TextType = TextType.Html
            });

            var htmlLabelMultipleLinesContainer = new ViewContainer <Label>(Test.Label.HtmlTextTypeMultipleLines,
                                                                            new Label
            {
                Text     = "<h1>Hello world!</h1><p>Lorem <strong>ipsum</strong> bla di bla <i>blabla</i> blablabl&nbsp;ablabla & blablablablabl ablabl ablablabl ablablabla blablablablablablab lablablabla blablab lablablabla blablabl ablablablab lablabla blab lablablabla blablab lablabla blablablablab lablabla blablab lablablabl ablablabla blablablablablabla blablabla</p>",
                TextType = TextType.Html,
                MaxLines = 3
            });

            var toggleLabel = new Label
            {
                TextType = TextType.Html,
                Text     = "<h1 style=\"color: red;\">Hello world!</h1><p>Lorem <strong>ipsum</strong></p>"
            };

            var htmlLabelProperties = new ViewContainer <Label>(Test.Label.HtmlTextLabelProperties, new Label
            {
                Text     = "<h1>End aligned. Green. ä</h1>",
                TextType = TextType.Html,
                HorizontalTextAlignment = TextAlignment.Center,
                TextColor = Color.Green,
            });

            var gestureRecognizer = new TapGestureRecognizer();

            gestureRecognizer.Tapped += (s, a) =>
            {
                toggleLabel.TextType = toggleLabel.TextType == TextType.Html ? TextType.Text : TextType.Html;
            };

            toggleLabel.GestureRecognizers.Add(gestureRecognizer);

            var toggleHtmlPlainTextLabelContainer = new ViewContainer <Label>(Test.Label.TextTypeToggle,
                                                                              toggleLabel);

            Add(namedSizeMediumBoldContainer);
            Add(namedSizeMediumItalicContainer);
            Add(namedSizeMediumUnderlineContainer);
            Add(namedSizeMediumStrikeContainer);
            Add(namedSizeLargeContainer);
            Add(namedSizeMediumContainer);
            Add(namedSizeMicroContainer);
            Add(namedSizeSmallContainer);
            Add(formattedTextContainer);
            Add(lineBreakModeCharacterWrapContainer);
            Add(lineBreakModeHeadTruncationContainer);
            Add(lineBreakModeMiddleTruncationContainer);
            Add(lineBreakModeNoWrapContainer);
            Add(lineBreakModeTailTruncationContainer);
            Add(lineBreakModeWordWrapContainer);
            Add(textContainer);
            Add(textColorContainer);
            Add(xAlignCenterContainer);
            Add(xAlignEndContainer);
            Add(xAlignStartContainer);
            Add(yAlignCenterContainer);
            Add(yAlignEndContainer);
            Add(yAlignStartContainer);
            Add(styleTitleContainer);
            Add(styleSubtitleContainer);
            Add(styleBodyContainer);
            Add(styleCaptionContainer);
            Add(maxlinesContainer);
            Add(maxlinesCharWrapContainer);
            Add(maxlinesHeadTruncContainer);
            Add(maxlinesMiddleTruncContainer);
            Add(maxlinesNoWrapContainer);
            Add(maxlinesTailTruncContainer);
            Add(maxlinesWordWrapContainer);
            Add(paddingContainer);
            Add(htmlLabelContainer);
            Add(htmlLabelMultipleLinesContainer);
            Add(htmlLabelProperties);
            Add(toggleHtmlPlainTextLabelContainer);
        }