// View constructor
        public NotesDetailPage(NotesPageViewModel notesPageViewModel)
        {
            // Init
            Title          = "Note Details";
            BindingContext = new NotesDetailPageViewModel(notesPageViewModel);


            // Note Title Entry
            var noteTitleEntry = new Entry
            {
                Placeholder     = "Note Title*",
                FontSize        = 20,
                BackgroundColor = Color.LightGray,
                Margin          = new Thickness(10, 10, 10, 0)
            };

            noteTitleEntry.SetBinding(Entry.TextProperty, nameof(NotesDetailPageViewModel.NoteTitle));


            // Note Text Editor
            var noteTextEditor = new Editor
            {
                Placeholder     = "Enter Note",
                FontSize        = 20,
                BackgroundColor = Color.LightGray,
                Margin          = new Thickness(10, 10, 10, 0),
                HeightRequest   = 120
            };

            noteTextEditor.SetBinding(Editor.TextProperty, nameof(NotesDetailPageViewModel.NoteText));


            // Has Due Date Switch
            var hasDueDateSwitch = new Switch
            {
                IsToggled         = false,
                HorizontalOptions = LayoutOptions.Start
            };

            hasDueDateSwitch.SetBinding(Switch.IsToggledProperty, nameof(NotesDetailPageViewModel.HasDueDate));

            var hasDueDateBundle = new StackLayout
            {
                Margin          = new Thickness(10, 10, 10, 0),
                BackgroundColor = Color.LightGray,
                Orientation     = StackOrientation.Horizontal,
                Children        =
                {
                    new Label
                    {
                        Text     = "Has Due Date?",
                        FontSize = 20,
                        Padding  = new Thickness(3, 8),
                    },
                    hasDueDateSwitch
                }
            };


            // Due Date Picker
            var dueDatePicker = new DatePicker
            {
                FontSize    = 20,
                MinimumDate = new DateTime(2019, 1, 1),
                MaximumDate = new DateTime(2022, 12, 31)
            };

            dueDatePicker.SetBinding(DatePicker.DateProperty, nameof(NotesDetailPageViewModel.DueDate));

            var dueDateBundle = new StackLayout
            {
                Margin          = new Thickness(10, 10, 10, 0),
                BackgroundColor = Color.LightGray,
                Children        =
                {
                    new Label
                    {
                        Text     = "Due Date",
                        FontSize = 20,
                        Padding  = new Thickness(3, 0)
                    },
                    dueDatePicker
                }
            };

            dueDateBundle.SetBinding(StackLayout.IsVisibleProperty, nameof(NotesDetailPageViewModel.HasDueDate));


            // Done Switch
            var doneSwitch = new Switch
            {
                IsToggled         = false,
                HorizontalOptions = LayoutOptions.Start
            };

            doneSwitch.SetBinding(Switch.IsToggledProperty, nameof(NotesDetailPageViewModel.Done));

            var doneBundle = new StackLayout
            {
                Margin          = new Thickness(10, 10, 10, 0),
                BackgroundColor = Color.LightGray,
                Orientation     = StackOrientation.Horizontal,
                Children        =
                {
                    new Label
                    {
                        Text     = "Done",
                        FontSize = 20,
                        Padding  = new Thickness(3, 8),
                    },
                    doneSwitch
                }
            };


            // Action Buttons
            var saveButton = new Button
            {
                Text            = "Save",
                FontSize        = 20,
                ImageSource     = ImageSource.FromResource("notes.Assets.disk.png"),
                TextColor       = Color.White,
                WidthRequest    = 160,
                BackgroundColor = (Color)App.Current.Resources["dctBlue"]
            };

            saveButton.SetBinding(Button.CommandProperty, nameof(NotesDetailPageViewModel.SaveNoteCommand));

            var deleteButton = new Button
            {
                Text            = "Delete",
                FontSize        = 20,
                Margin          = new Thickness(10, 0),
                ImageSource     = ImageSource.FromResource("notes.Assets.trash.png"),
                TextColor       = Color.White,
                WidthRequest    = 160,
                BackgroundColor = (Color)App.Current.Resources["dctBlue"]
            };

            deleteButton.SetBinding(Button.CommandProperty, nameof(NotesDetailPageViewModel.DeleteNoteCommand));

            var actionButtonsBundle = new StackLayout
            {
                Margin      = new Thickness(10),
                Orientation = StackOrientation.Horizontal,
                Children    =
                {
                    saveButton,
                    deleteButton
                }
            };


            // Footnote
            var footnote = new Label
            {
                Text           = "* Required",
                FontSize       = 15,
                FontAttributes = FontAttributes.Italic,
                TextColor      = Color.Gray,
                Margin         = new Thickness(10, 0)
            };


            // Load up page content
            Content = new StackLayout
            {
                Children =
                {
                    noteTitleEntry,
                    noteTextEditor,
                    hasDueDateBundle,
                    dueDateBundle,
                    doneBundle,
                    actionButtonsBundle,
                    footnote
                }
            };
        }
        public DoctorsAgendaTemplate()
        {
            StackLayout row = new StackLayout()
            {
                Orientation       = StackOrientation.Horizontal,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                Padding           = 0,
                Spacing           = 0
                                    // HeightRequest = 60,
            };

            Label ScheduleLbl = new Label
            {
                VerticalOptions = LayoutOptions.CenterAndExpand,
                TextColor       = theme.LabelTextDark,
                WidthRequest    = 50,
                Resources       = theme.LabelStyleNormal,
            };

            ScheduleLbl.SetBinding(Label.TextProperty, new Binding(path: "Begin", stringFormat: "{0:HH:mm}"));

            StackLayout schArea = new StackLayout
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Spacing           = 0,
                VerticalOptions   = LayoutOptions.Fill,
                Padding           = 0
            };

            schArea.SetBinding(StackLayout.BackgroundColorProperty,
                               new Binding("hasSchedules",
                                           BindingMode.Default,
                                           new ConvertBoolToColor()));

            BoxView lineSeparator = new BoxView
            {
                HeightRequest     = 1,
                Color             = theme.LineLight,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.End
            };

            row.Children.Add(ScheduleLbl);
            row.Children.Add(schArea);

            StackLayout mainLayout = new StackLayout()
            {
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Padding           = 0,
                Spacing           = 0,
                Children          =
                {
                    row,
                },
            };

            if (Device.OS == TargetPlatform.Android)
            {
                mainLayout.Children.Add(lineSeparator);
            }

            View = mainLayout;
        }
        public BaseTranslatePage()
        {
            this.listView = new TranslateListView
            {
                HasUnevenRows = true
            };
            this.Content = this.listView;
            this.listView.ItemTemplate = new DataTemplate(() =>
            {
                var nameLabel = new Label
                {
                    FontSize = 14
                };
                var descriptionLabel = new Label
                {
                    FontSize        = 12,
                    TextColor       = Color.DarkGray,
                    LineBreakMode   = LineBreakMode.WordWrap,
                    VerticalOptions = LayoutOptions.FillAndExpand
                };

                nameLabel.SetBinding(Label.TextProperty, "Title");
                descriptionLabel.SetBinding(Label.TextProperty, "Description");
                var checkBox = new LocaleSwitch {
                    IsEnabled = false
                };
                checkBox.SetBinding(Switch.IsToggledProperty, "IsChecked", BindingMode.TwoWay);
                checkBox.VerticalOptions = LayoutOptions.End;

                // download
                var progressBar   = new ProgressBar();
                var downloadLabel = new Label();
                progressBar.SetBinding(ProgressBar.ProgressProperty, "DownloadProgress");
                progressBar.SetBinding(IsVisibleProperty, "IsDownload");
                downloadLabel.SetBinding(IsVisibleProperty, "IsDownload", converter: new InvertedBooleanConverter());
                downloadLabel.SetBinding(Label.TextProperty, "DownloadLabel");
                var downloadView = new StackLayout
                {
                    Children =
                    {
                        progressBar,
                        downloadLabel
                    }
                };
                downloadView.SetBinding(IsVisibleProperty, "IsRemote");

                return(new ViewCell
                {
                    View = new StackLayout
                    {
                        Padding = new Thickness(0, 5),
                        HorizontalOptions = LayoutOptions.FillAndExpand,
                        Margin = new Thickness(8, 0, 0, 8),
                        Orientation = StackOrientation.Horizontal,
                        Children =
                        {
                            new StackLayout
                            {
                                VerticalOptions = LayoutOptions.Center,
                                HorizontalOptions = LayoutOptions.FillAndExpand,
                                Spacing = 0,
                                Children =
                                {
                                    nameLabel,
                                    descriptionLabel,
                                    downloadView
                                }
                            },
                            checkBox
                        }
                    }
                });
            });

            var translateViewModel = this.TranslateViewModel;

            this.BindingContext = translateViewModel;
            this.Title          = translateViewModel.Title;
            this.listView.SetBinding(ListView.ItemsSourceProperty, "Items");
            this.listView.ItemSelected += (s, e) =>
            {
                if (!(e.SelectedItem is LocaleCellElement localeCellElement))
                {
                    return;
                }

                localeCellElement.Command.Execute(localeCellElement);
                this.listView.SelectedItem = null;
            };

            var contentDetails = new ToolbarItem
            {
                Text     = "Test Locale",
                Priority = 10,
                Command  = new Command(async() =>
                {
                    if (I18N.Instance.CurrentLocale == null)
                    {
                        await this.DisplayAlert("Test Locale", "Please select any locale", "OK");
                        return;
                    }

                    await this.Navigation.PushModalAsync(new NavigationPage(new ContentDetailsPage()));
                })
            };

            this.ToolbarItems.Add(contentDetails);
        }
Example #4
0
        public TabbedPageDemoPageCS()
        {
            var booleanConverter = new NonNullToBooleanConverter();

            ItemTemplate = new DataTemplate(() => {
                var nameLabel = new Label
                {
                    FontSize          = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
                    FontAttributes    = FontAttributes.Bold,
                    HorizontalOptions = LayoutOptions.Center
                };
                nameLabel.SetBinding(Label.TextProperty, "Name");

                var image = new Image {
                    WidthRequest = 200, HeightRequest = 200
                };
                image.SetBinding(Image.SourceProperty, "Address");

                var familyLabel = new Label
                {
                    FontSize       = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
                    FontAttributes = FontAttributes.Bold
                };
                familyLabel.SetBinding(Label.TextProperty, "Type");

                var subFamilyLabel = new Label
                {
                    FontSize       = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
                    FontAttributes = FontAttributes.Bold
                };
                subFamilyLabel.SetBinding(Label.TextProperty, "Subfamily");

                var tribeLabel = new Label
                {
                    FontSize       = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
                    FontAttributes = FontAttributes.Bold
                };
                tribeLabel.SetBinding(Label.TextProperty, "Tribe");

                var genusLabel = new Label
                {
                    FontSize       = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
                    FontAttributes = FontAttributes.Bold
                };
                genusLabel.SetBinding(Label.TextProperty, "Genus");

                var subFamilyStackLayout = new StackLayout
                {
                    Orientation = StackOrientation.Horizontal,
                    Children    =
                    {
                        new Label {
                            Text = "Subfamily:", HorizontalOptions = LayoutOptions.FillAndExpand
                        },
                        subFamilyLabel
                    }
                };
                subFamilyStackLayout.SetBinding(VisualElement.IsVisibleProperty, new Binding("Subfamily", BindingMode.Default, booleanConverter));

                var tribeStackLayout = new StackLayout
                {
                    Orientation = StackOrientation.Horizontal,
                    Children    =
                    {
                        new Label {
                            Text = "Tribe:", HorizontalOptions = LayoutOptions.FillAndExpand
                        },
                        tribeLabel
                    }
                };
                tribeStackLayout.SetBinding(VisualElement.IsVisibleProperty, new Binding("Tribe", BindingMode.Default, booleanConverter));

                var contentPage = new ContentPage
                {
                    Icon    = "logo.png",
                    Content = new StackLayout
                    {
                        Padding  = new Thickness(5, 25),
                        Children =
                        {
                            nameLabel,
                            image,
                            new StackLayout {
                                Padding  = new Thickness(50,                    10),
                                Children =
                                {
                                    new StackLayout   {
                                        Orientation = StackOrientation.Horizontal,
                                        Children    =
                                        {
                                            new Label {
                                                Text = "Type:",HorizontalOptions = LayoutOptions.FillAndExpand
                                            },
                                            familyLabel
                                        }
                                    },
                                    subFamilyStackLayout,
                                    tribeStackLayout,
                                    new StackLayout   {
                                        Orientation = StackOrientation.Horizontal,
                                        Children    =
                                        {
                                            new Label {
                                                Text = "Type:",HorizontalOptions = LayoutOptions.FillAndExpand
                                            },
                                            genusLabel
                                        }
                                    }
                                }
                            }
                        }
                    }
                };
                contentPage.SetBinding(TitleProperty, "Type");

                return(contentPage);
            });

            //ItemsSource = MonkeyDataModel.All;
        }
        private void CargarListaHojas()
        {
            var listaHojas = new List <ClaseHoja>();
            var esTeclaPar = false;

            foreach (var datosHoja in _listaHojas)
            {
                //Sólo lista hojas que contengan la palabra App (es el sufijo que tendrán las hojas para carga de movimientos, las otras son para cálculos y análisis).
                if (!datosHoja.Title.Text.Contains("App"))
                {
                    continue;
                }

                var linkHoja         = datosHoja.Links.FindService(GDataSpreadsheetsNameTable.CellRel, null).HRef.ToString();
                var linkHistoricos   = datosHoja.Links.FindService(GDataSpreadsheetsNameTable.ListRel, null).HRef.ToString();
                var estaSeleccionada = CuentaUsuario.ObtenerLinkHojaConsulta() == linkHoja; // Tiene que ser la actualmente seleccionada
                var estaUsada        = CuentaUsuario.VerificarHojaUsada(linkHoja);          // Tiene que haber sido seleccionada alguna vez.
                var esHistorico      = CuentaUsuario.VerificarHojaHistoricosUsada(linkHistoricos);
                var esPuntosVenta    = CuentaUsuario.VerificarHojaPuntosVentaUsada(linkHoja);

                if (estaSeleccionada || estaUsada || esHistorico)
                {
                    continue;
                }
                var hoja = new ClaseHoja(linkHoja, datosHoja.Title.Text, false, false, false, esPuntosVenta, esTeclaPar);
                listaHojas.Add(hoja);
                esTeclaPar = !esTeclaPar;
            }

            var vista = new ListView
            {
                RowHeight         = 60,
                VerticalOptions   = LayoutOptions.StartAndExpand,
                HorizontalOptions = LayoutOptions.Fill,
                ItemsSource       = listaHojas,
                ItemTemplate      = new DataTemplate(() =>
                {
                    var nombreHoja = new Label
                    {
                        FontSize          = 18,
                        TextColor         = Color.FromHex("#1D1D1B"),
                        VerticalOptions   = LayoutOptions.CenterAndExpand,
                        HorizontalOptions = LayoutOptions.CenterAndExpand
                    };
                    nombreHoja.SetBinding(Label.TextProperty, "Nombre");

                    var icono = new Image
                    {
                        VerticalOptions   = LayoutOptions.Center,
                        HorizontalOptions = LayoutOptions.End,
                        HeightRequest     = App.AnchoRetratoDePantalla * .09259
                    };
                    icono.SetBinding(Image.SourceProperty, "ArchivoIcono");
                    icono.SetBinding(IsVisibleProperty, "TieneImagen");

                    var tecla = new StackLayout
                    {
                        Padding     = 7,
                        Orientation = StackOrientation.Horizontal,
                        Children    = { nombreHoja, icono }
                    };
                    tecla.SetBinding(BackgroundColorProperty, "ColorFondo");

                    var celda = new ViewCell {
                        View = tecla
                    };

                    celda.Tapped += (sender, args) =>
                    {
                        var hoja = (ClaseHoja)((ViewCell)sender).BindingContext;
                        EnviarPaginaSeleccionColumnas(hoja.Link);
                        celda.View.BackgroundColor = Color.Silver;
                    };

                    return(celda);
                })
            };

            ContenedorHojas.Children.Clear();
            ContenedorHojas.Children.Add(vista);
        }
Example #6
0
        public OwnCases()
        {
            this.Title          = "My cases";
            this.BindingContext = new OwnCasesViewModel();

            var activityIndicator = new ActivityIndicator
            {
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                Color             = Color.Black,
                IsVisible         = false
            };

            activityIndicator.SetBinding(ActivityIndicator.IsRunningProperty, new Binding("IsBusy"));
            activityIndicator.SetBinding(ActivityIndicator.IsVisibleProperty, new Binding("IsBusy"));

            var iCTLogo = new Image
            {
                HeightRequest     = 50,
                HorizontalOptions = LayoutOptions.StartAndExpand,
                VerticalOptions   = LayoutOptions.Fill,
                Source            = "CT_logo_sm.png"
            };

            var iMenu = new Image
            {
                HeightRequest     = 40,
                HorizontalOptions = LayoutOptions.EndAndExpand,
                VerticalOptions   = LayoutOptions.Fill,
                Source            = "menu_alt.png"
            };

            iMenu.GestureRecognizers.Add(new TapGestureRecognizer((obj) =>
            {
                _vm.IsMenuVisible = !_vm.IsMenuVisible;
            }));

            var stackHeader = new StackLayout
            {
                HorizontalOptions = LayoutOptions.Fill,
                VerticalOptions   = LayoutOptions.Fill,
                IsClippedToBounds = true,
                Orientation       = StackOrientation.Horizontal,
                Padding           = new Thickness(0, 0, 0, 5),
                Children          = { iCTLogo, iMenu }
            };


            var lblTitleGreetings = new Label
            {
                HorizontalOptions       = LayoutOptions.Fill,
                HorizontalTextAlignment = TextAlignment.Center,
                FontSize = 16,
                Text     = "Welcome Mr John Doe (Referrer, T1)"
            };

            CTIconHome   icoHome   = new CTIconHome();
            CTIconHelp   icoHelp   = new CTIconHelp();
            CTIconLogout icoLogout = new CTIconLogout();

            var bxvTop = new BoxView
            {
                HeightRequest     = 2,
                HorizontalOptions = LayoutOptions.Fill,
                Color             = Color.FromHex(Constants.HEX_LINE_MENU),
                Margin            = new Thickness(0, 5, 0, 0)
            };

            var bxvBottom = new BoxView
            {
                HeightRequest     = 2,
                HorizontalOptions = LayoutOptions.Fill,
                Color             = Color.FromHex(Constants.HEX_LINE_MENU),
                Margin            = new Thickness(0, 0, 0, 30)
            };

            var bxvLeftHome = new BoxView
            {
                WidthRequest    = 2,
                VerticalOptions = LayoutOptions.Fill,
                Color           = Color.FromHex(Constants.HEX_LINE_MENU)
            };

            var bxvLeftHelp = new BoxView
            {
                WidthRequest    = 2,
                VerticalOptions = LayoutOptions.Fill,
                Color           = Color.FromHex(Constants.HEX_LINE_MENU)
            };

            var bxvLeftLogout = new BoxView
            {
                WidthRequest    = 2,
                VerticalOptions = LayoutOptions.Fill,
                Color           = Color.FromHex(Constants.HEX_LINE_MENU)
            };

            var stackMenu = new StackLayout
            {
                HeightRequest     = 40,
                HorizontalOptions = LayoutOptions.End,
                VerticalOptions   = LayoutOptions.Fill,
                IsClippedToBounds = true,
                Orientation       = StackOrientation.Horizontal,
                Children          =
                {
                    bxvLeftHome,   icoHome.View,
                    bxvLeftHelp,   icoHelp.View,
                    bxvLeftLogout, icoLogout.View
                }
            };

            stackMenu.SetBinding(IsVisibleProperty, new Binding("IsMenuVisible"));

            var lblTitleSection = new Label
            {
                HorizontalOptions       = LayoutOptions.Fill,
                HorizontalTextAlignment = TextAlignment.Start,
                Margin         = new Thickness(10, 0, 10, 20),
                FontSize       = 20,
                FontAttributes = FontAttributes.Bold,
                Text           = "Your cases"
            };

            var viewTemplateCaseItem = new DataTemplate(typeof(CaseItem));

            lstvCases = new ListView
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HasUnevenRows     = true,
                Margin            = new Thickness(2),
                ItemTemplate      = viewTemplateCaseItem
            };
            lstvCases.SetBinding(ItemsView <Cell> .ItemsSourceProperty, new Binding("Cases"));
            lstvCases.ItemTapped += (sender, e) =>
            {
                var case_item = (Case)e.Item;

                if (_vm.CaseSelected != null)
                {
                    if (_vm.CaseSelected.id == case_item.id)
                    {
                        ((ListView)sender).SelectedItem = null;                         // de-select the row

                        _vm.IsCaseSelected = false;
                        _vm.CaseSelected   = null;

                        return;
                    }
                    else
                    {
                        _vm.IsCaseSelected = true;
                        _vm.CaseSelected   = case_item;
                    }
                }
                else
                {
                    _vm.IsCaseSelected = true;
                    _vm.CaseSelected   = case_item;
                }
            };

            lblMessage = new Label
            {
                HorizontalOptions       = LayoutOptions.StartAndExpand,
                HorizontalTextAlignment = TextAlignment.Start,
                FontAttributes          = FontAttributes.Italic
            };
            lblMessage.SetBinding(Label.TextProperty, new Binding("Message"));

            btnAdd = new Button
            {
                HorizontalOptions = LayoutOptions.Fill,
                Text = "Add"
            };
            btnAdd.SetBinding(Button.CommandProperty, new Binding("AddCaseCommand"));

            btnUpdate = new Button
            {
                HorizontalOptions = LayoutOptions.Fill,
                Text = "Update"
            };
            btnUpdate.SetBinding(Button.CommandProperty, new Binding("UpdateCaseCommand"));
            btnUpdate.SetBinding(IsEnabledProperty, new Binding("IsCaseSelected"));

            btnDelete = new Button
            {
                HorizontalOptions = LayoutOptions.Fill,
                Text = "Delete"
            };
            btnDelete.SetBinding(Button.CommandProperty, new Binding("DeleteCaseCommand"));
            btnDelete.SetBinding(IsEnabledProperty, new Binding("IsCaseSelected"));

            StackLayout stackButtons = new StackLayout
            {
                HorizontalOptions = LayoutOptions.Fill,
                Orientation       = StackOrientation.Horizontal,
                Children          =
                {
                    btnAdd, btnUpdate, btnDelete
                }
            };

            StackLayout stackMain = new StackLayout
            {
                HorizontalOptions = LayoutOptions.Fill,
                VerticalOptions   = LayoutOptions.Fill,
                Spacing           = 0,
                Margin            = new Thickness(2),
                Children          =
                {
                    activityIndicator,
                    stackHeader,
                    //lblTitleGreetings,
                    bxvTop,
                    stackMenu,
                    bxvBottom,
                    lblTitleSection,
                    lstvCases                    /*,
                                                  * lblMessage,
                                                  * stackButtons*/
                }
            };

            Content = stackMain;
        }
        private async Task Init()
        {
            _viewModel = new CountyDetailsViewModel();
            await _viewModel.GetCounties();

            _viewModel.GetChapters();

            _pickerCounties = new PickerWithNoSpellCheck()
            {
                HorizontalOptions = LayoutOptions.FillAndExpand
            };
            foreach (var county in _viewModel.CountyList)
            {
                _pickerCounties.Items.Add(county.Key);
            }

            var lblCompare = new Label
            {
                VerticalOptions = LayoutOptions.Center,
                Text            = "compara cu"
            };

            _pickerCounties2 = new PickerWithNoSpellCheck()
            {
                HorizontalOptions = LayoutOptions.FillAndExpand
            };
            _pickerCounties2.Items.Add("──────");
            foreach (var county in _viewModel.CountyList)
            {
                _pickerCounties2.Items.Add(county.Key);
            }

            _pickerChapters = new PickerWithNoSpellCheck()
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Title             = "Selecteaza indicatorul statistic",
            };
            foreach (var chapter in _viewModel.ChapterList)
            {
                _pickerChapters.Items.Add(chapter.Key);
            }

            _degChapterData                   = new GridControl();
            _degChapterData.IsReadOnly        = true;
            _degChapterData.HorizontalOptions = LayoutOptions.FillAndExpand;
            _degChapterData.VerticalOptions   = LayoutOptions.FillAndExpand;
            _degChapterData.Columns.Add(new TextColumn()
            {
                Caption = "An", FieldName = "Year", IsReadOnly = true, AllowSort = DefaultBoolean.False
            });
            _degChapterData.Columns.Add(new TextColumn()
            {
                Caption = "Luna", FieldName = "YearFraction", IsReadOnly = true, AllowSort = DefaultBoolean.False
            });
            var valueColumn = new TextColumn()
            {
                FieldName  = "Value",
                IsReadOnly = true,
                AllowSort  = DefaultBoolean.False
            };

            valueColumn.SetBinding(TextColumn.CaptionProperty, new Binding("ValueColumnCaption", source: _viewModel));
            _degChapterData.Columns.Add(valueColumn);
            var valueColumn2 = new TextColumn()
            {
                FieldName  = "Value2",
                IsReadOnly = true,
                AllowSort  = DefaultBoolean.False
            };

            valueColumn2.SetBinding(TextColumn.CaptionProperty, new Binding("Value2ColumnCaption", source: _viewModel));
            valueColumn2.SetBinding(TextColumn.IsVisibleProperty, new Binding("Value2ColumnVisibility", source: _viewModel));
            _degChapterData.Columns.Add(valueColumn2);
            _degChapterData.ItemsSource = _viewModel.ChapterDataReversed;
            _degChapterData.RowTap     += degChapterData_RowTap;

            _plotView = new PlotView();
            _plotView.HorizontalOptions = LayoutOptions.FillAndExpand;
            _plotView.VerticalOptions   = LayoutOptions.FillAndExpand;
            _plotView.Model             = new PlotModel();
            var series = new LineSeries();

            series.ItemsSource = _viewModel.ChapterData;
            _plotView.Model.Series.Add(series);
            _plotView.Model.Title     = "Evolutie indicator";
            _plotView.BackgroundColor = Color.FromRgb(51, 51, 51);

            _dataControls = new StackLayout()
            {
                Orientation       = StackOrientation.Vertical,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                Spacing           = 0,
                Children          = { _degChapterData, _plotView }
            };
            _dataControls.SetBinding(StackLayout.IsVisibleProperty, new Binding("HasData", source: _viewModel));

            var btnTest = new Button()
            {
                Text = "Test"
            };

            btnTest.Clicked += btnTest_Clicked;

            this.Content = new StackLayout
            {
                VerticalOptions = LayoutOptions.FillAndExpand,
                Padding         = new Thickness(
                    left: 0,
                    right: 0,
                    bottom: 0,
                    top: Device.OnPlatform(iOS: 20, Android: 5, WinPhone: 0)),
                Children =
                {
                    new StackLayout()
                    {
                        HorizontalOptions = LayoutOptions.FillAndExpand,
                        Orientation       = StackOrientation.Horizontal,
                        Padding           = new Thickness(0, 2),
                        Children          =
                        {
                            _pickerCounties, lblCompare, _pickerCounties2    //, btnTest
                        }
                    },
                    _pickerChapters,
                    //degChapterData,
                    //plotView
                    _dataControls
                }
            };

            _pickerCounties.SelectedIndex     = Settings.County1;
            _pickerCounties2.SelectedIndex    = Settings.County2;
            _pickerChapters.SelectedIndex     = Settings.Chapter;
            _degChapterData.SelectedRowHandle = -1;

            _pickerCounties.SelectedIndexChanged  += picker_SelectedIndexChanged;
            _pickerCounties2.SelectedIndexChanged += picker_SelectedIndexChanged;
            _pickerChapters.SelectedIndexChanged  += picker_SelectedIndexChanged;

            await LoadData();
        }
Example #8
0
        public void Init()
        {
            // Not Started

            var notStartedLabel = new Label
            {
                Text                    = AppResources.ExtensionInstantAccess,
                VerticalOptions         = LayoutOptions.Start,
                HorizontalOptions       = LayoutOptions.Center,
                HorizontalTextAlignment = TextAlignment.Center,
                LineBreakMode           = LineBreakMode.WordWrap,
                FontSize                = Device.GetNamedSize(NamedSize.Large, typeof(Label))
            };

            var notStartedSublabel = new Label
            {
                Text                    = AppResources.ExtensionTurnOn,
                VerticalOptions         = LayoutOptions.Start,
                HorizontalOptions       = LayoutOptions.Center,
                HorizontalTextAlignment = TextAlignment.Center,
                LineBreakMode           = LineBreakMode.WordWrap
            };

            var notStartedImage = new CachedImage
            {
                Source            = "ext-more",
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.Center,
                Margin            = new Thickness(0, -10, 0, 0),
                WidthRequest      = 290,
                HeightRequest     = 252
            };

            var notStartedButton = new ExtendedButton
            {
                Text              = AppResources.ExtensionEnable,
                Command           = new Command(() => ShowExtension("NotStartedEnable")),
                VerticalOptions   = LayoutOptions.End,
                HorizontalOptions = LayoutOptions.Fill,
                Style             = (Style)Application.Current.Resources["btn-primary"]
            };

            var notStartedStackLayout = new StackLayout
            {
                Orientation     = StackOrientation.Vertical,
                Spacing         = 20,
                Padding         = new Thickness(20, 20, 20, 30),
                Children        = { notStartedLabel, notStartedSublabel, notStartedImage, notStartedButton },
                VerticalOptions = LayoutOptions.FillAndExpand
            };

            notStartedStackLayout.SetBinding <AppExtensionPageModel>(IsVisibleProperty, m => m.NotStarted);

            // Not Activated

            var notActivatedLabel = new Label
            {
                Text                    = AppResources.ExtensionAlmostDone,
                VerticalOptions         = LayoutOptions.Start,
                HorizontalOptions       = LayoutOptions.Center,
                HorizontalTextAlignment = TextAlignment.Center,
                LineBreakMode           = LineBreakMode.WordWrap,
                FontSize                = Device.GetNamedSize(NamedSize.Large, typeof(Label))
            };

            var notActivatedSublabel = new Label
            {
                Text                    = AppResources.ExtensionTapIcon,
                VerticalOptions         = LayoutOptions.Start,
                HorizontalOptions       = LayoutOptions.Center,
                HorizontalTextAlignment = TextAlignment.Center,
                LineBreakMode           = LineBreakMode.WordWrap
            };

            var notActivatedImage = new CachedImage
            {
                Source            = "ext-act",
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.Center,
                Margin            = new Thickness(0, -10, 0, 0),
                WidthRequest      = 290,
                HeightRequest     = 252
            };

            var notActivatedButton = new ExtendedButton
            {
                Text              = AppResources.ExtensionEnable,
                Command           = new Command(() => ShowExtension("NotActivatedEnable")),
                VerticalOptions   = LayoutOptions.End,
                HorizontalOptions = LayoutOptions.Fill,
                Style             = (Style)Application.Current.Resources["btn-primary"]
            };

            var notActivatedStackLayout = new StackLayout
            {
                Orientation     = StackOrientation.Vertical,
                Spacing         = 20,
                Padding         = new Thickness(20, 20, 20, 30),
                Children        = { notActivatedLabel, notActivatedSublabel, notActivatedImage, notActivatedButton },
                VerticalOptions = LayoutOptions.FillAndExpand
            };

            notActivatedStackLayout.SetBinding <AppExtensionPageModel>(IsVisibleProperty, m => m.StartedAndNotActivated);

            // Activated

            var activatedLabel = new Label
            {
                Text                    = AppResources.ExtensionReady,
                VerticalOptions         = LayoutOptions.Start,
                HorizontalOptions       = LayoutOptions.Center,
                HorizontalTextAlignment = TextAlignment.Center,
                LineBreakMode           = LineBreakMode.WordWrap,
                FontSize                = Device.GetNamedSize(NamedSize.Large, typeof(Label))
            };

            var activatedSublabel = new Label
            {
                Text                    = AppResources.ExtensionInSafari,
                VerticalOptions         = LayoutOptions.Start,
                HorizontalOptions       = LayoutOptions.Center,
                HorizontalTextAlignment = TextAlignment.Center,
                LineBreakMode           = LineBreakMode.WordWrap,
                Margin                  = new Thickness(0, 10, 0, 0)
            };

            var activatedImage = new CachedImage
            {
                Source            = "ext-use",
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.Center,
                Margin            = new Thickness(0, -10, 0, 0),
                WidthRequest      = 290,
                HeightRequest     = 252
            };

            var activatedButton = new ExtendedButton
            {
                Text    = AppResources.ExtensionSeeApps,
                Command = new Command(() =>
                {
                    _googleAnalyticsService.TrackAppEvent("SeeSupportedApps");
                    Device.OpenUri(new Uri("https://bitwarden.com/ios/"));
                }),
                VerticalOptions   = LayoutOptions.End,
                HorizontalOptions = LayoutOptions.Fill,
                Style             = (Style)Application.Current.Resources["btn-primary"]
            };

            var activatedButtonReenable = new ExtendedButton
            {
                Text              = AppResources.ExntesionReenable,
                Command           = new Command(() => ShowExtension("Re-enable")),
                VerticalOptions   = LayoutOptions.End,
                HorizontalOptions = LayoutOptions.Fill,
                Style             = (Style)Application.Current.Resources["btn-primaryAccent"]
            };

            var activatedStackLayout = new StackLayout
            {
                Orientation     = StackOrientation.Vertical,
                Spacing         = 10,
                Padding         = new Thickness(20, 20, 20, 30),
                VerticalOptions = LayoutOptions.FillAndExpand,
                Children        = { activatedLabel, activatedSublabel, activatedImage, activatedButton, activatedButtonReenable }
            };

            activatedStackLayout.SetBinding <AppExtensionPageModel>(IsVisibleProperty, m => m.StartedAndActivated);

            var stackLayout = new StackLayout
            {
                Children        = { notStartedStackLayout, notActivatedStackLayout, activatedStackLayout },
                VerticalOptions = LayoutOptions.FillAndExpand
            };

            if (Device.OS == TargetPlatform.iOS)
            {
                ToolbarItems.Add(new DismissModalToolBarItem(this, AppResources.Close));
            }

            Title   = AppResources.AppExtension;
            Content = new ScrollView {
                Content = stackLayout
            };
            BindingContext = Model;
        }
Example #9
0
        public TodoPage()
        {
            this.Title = "Todo List";

            var fab = new CoreFloatingActionButton()
            {
                Size         = FABControlSize.Normal,
                ColorNormal  = CoreStyles.NavigationBarColor,
                ColorPressed = CoreStyles.NavigationBarColor.MultiplyAlpha(0.4),
                ImageName    = "plus.png",
            };

            fab.SetBinding(CoreFloatingActionButton.CommandProperty, "FABClicked");
            AbsoluteLayout.SetLayoutFlags(fab, AbsoluteLayoutFlags.PositionProportional);
            AbsoluteLayout.SetLayoutBounds(fab, new Rectangle(0.95f, 0.95f, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize));

            var lst = new CoreListView()
            {
                IsPullToRefreshEnabled = true,
                ItemTemplate           = new DataTemplate(typeof(TodoPageCell)),
                RowHeight = 65
            };

            lst.SetBinding(CoreListView.ItemsSourceProperty, "CurrentTodoList");
            lst.SetBinding(CoreListView.IsRefreshingProperty, "IsRefreshing");
            lst.SetBinding(CoreListView.RefreshCommandProperty, "RefreshData");
            lst.SetBinding(CoreListView.IsVisibleProperty, "DataExists");
            lst.Effects.Add(new HideListSeparatorEffect());
#if __IOS__
            lst.Effects.Add(new RemoveEmptyRowsEffect());
#endif


            var imgLabel = new Label()
            {
                FontSize          = 75,
                TextColor         = Color.LightGray,
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center
            };
            imgLabel.SetBinding(Label.TextProperty, "EmptyDataIcon.Unicode");
            imgLabel.SetBinding(Label.FontFamilyProperty, "EmptyDataIcon.FontFamily");

            var imgDescription = new Label()
            {
                TextColor               = Color.LightGray,
                FontSize                = 32,
                HorizontalOptions       = LayoutOptions.Center,
                VerticalOptions         = LayoutOptions.Center,
                HorizontalTextAlignment = TextAlignment.Center,
                Text = "The dataset is empty. Try adding an item manually."
            };

            var emptyPanel = new StackLayout()
            {
                Padding  = 30,
                Children = { imgLabel, imgDescription }
            };
            emptyPanel.SetBinding(StackLayout.IsVisibleProperty,
                                  new Binding(path: "DataExists", converter: AppConverters.ReverseBoolean));

            Content = new StackLayout()
            {
                Children = { lst, emptyPanel }
            };

            AbsoluteLayer.Children.Add(fab);
        }
Example #10
0
        private async Task Init()
        {
            _viewModel = new CountyStandingsViewModel();

            BindingContext = _viewModel;

            _viewModel.GetChapters();
            _viewModel.GetYears();
            _viewModel.GetYearFractions();

            _pickerChapters = new PickerWithNoSpellCheck()
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Title             = "Selecteaza indicatorul statistic",
            };
            foreach (var chapter in _viewModel.ChapterList)
            {
                _pickerChapters.Items.Add(chapter.Key);
            }

            var lblYear = new Label
            {
                VerticalOptions = LayoutOptions.Center,
                Text            = "An:"
            };

            _pickerYears = new PickerWithNoSpellCheck()
            {
                HorizontalOptions = LayoutOptions.FillAndExpand
            };
            foreach (var year in _viewModel.YearList)
            {
                _pickerYears.Items.Add(year);
            }

            var lblYearFraction = new Label
            {
                VerticalOptions = LayoutOptions.Center,
                Text            = "Luna:"
            };

            _pickerYearFractions = new PickerWithNoSpellCheck()
            {
                HorizontalOptions = LayoutOptions.FillAndExpand
            };
            foreach (var yearFraction in _viewModel.YearFractionList)
            {
                _pickerYearFractions.Items.Add(yearFraction);
            }

            _degStandings                        = new GridControl();
            _degStandings.IsReadOnly             = true;
            _degStandings.HorizontalOptions      = LayoutOptions.FillAndExpand;
            _degStandings.TotalSummaryVisibility = DevExpress.Mobile.Core.VisibilityState.Always;
            _degStandings.Columns.Add(new TextColumn()
            {
                Caption = "Pozitie", FieldName = "Position", IsReadOnly = true, AllowSort = DefaultBoolean.False
            });
            _degStandings.Columns.Add(new TextColumn()
            {
                Caption = "Judet", FieldName = "County", IsReadOnly = true, AllowSort = DefaultBoolean.False
            });
            var valueColumn = new TextColumn()
            {
                FieldName     = "Value",
                IsReadOnly    = true,
                AllowSort     = DefaultBoolean.False,
                DisplayFormat = "{0:0}",
            };

            valueColumn.SetBinding(TextColumn.CaptionProperty, new Binding("ValueColumnCaption", source: _viewModel));
            _degStandings.Columns.Add(valueColumn);
            _degStandings.ItemsSource = _viewModel.Standings;
            _degStandings.RowTap     += degAverageGrosSalary_RowTap;
            _degStandings.TotalSummaries.Add(new GridColumnSummary {
                FieldName = "County", Type = SummaryType.Count, DisplayFormat = "TOTAL"
            });
            _degStandings.TotalSummaries.Add(new GridColumnSummary {
                FieldName = "Value", Type = SummaryType.None, DisplayFormat = "{0:0}"
            });
            _degStandings.SetBinding(GridControl.IsVisibleProperty, "HasData");

            var lblNoData = new Label()
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Text = "Nu exista date disponibile pentru intervalul selectat",
                HorizontalTextAlignment = TextAlignment.Center,
                VerticalTextAlignment   = TextAlignment.Center,
                FontSize = 27,
            };
            var btnForceDataLoading = new Button()
            {
                Text = "Forteaza incarcarea datelor",
            };

            btnForceDataLoading.Clicked += btnForceDataLoading_Clicked;

            var stackNoData = new StackLayout()
            {
                VerticalOptions = LayoutOptions.FillAndExpand,
                Spacing         = 20,
                Padding         = new Thickness(0),
                Children        =
                {
                    lblNoData,
                    btnForceDataLoading
                }
            };

            stackNoData.SetBinding(Label.IsVisibleProperty, "DoesNotHaveData");

            this.Content = new StackLayout
            {
                VerticalOptions = LayoutOptions.FillAndExpand,
                Padding         = new Thickness(
                    left: 0,
                    right: 0,
                    bottom: 0,
                    top: Device.OnPlatform(iOS: 20, Android: 5, WinPhone: 0)),
                Children =
                {
                    _pickerChapters,
                    new StackLayout()
                    {
                        HorizontalOptions = LayoutOptions.FillAndExpand,
                        Orientation       = StackOrientation.Horizontal,
                        Padding           = new Thickness(5, 0,               0, 0),
                        Children          =
                        {
                            lblYear, _pickerYears,lblYearFraction, _pickerYearFractions
                        }
                    },
                    _degStandings,
                    stackNoData
                }
            };

            _pickerChapters.SelectedIndex      = Settings.StandingsChapter;
            _pickerYears.SelectedIndex         = _pickerYears.Items.IndexOf(App.LastYearAvailableData.ToString());
            _pickerYearFractions.SelectedIndex = _pickerYearFractions.Items.IndexOf(App.LastMonthAvailableData.ToString());

            _pickerChapters.SelectedIndexChanged      += picker_SelectedIndexChanged;
            _pickerYears.SelectedIndexChanged         += picker_SelectedIndexChanged;
            _pickerYearFractions.SelectedIndexChanged += picker_SelectedIndexChanged;

            await LoadData();
        }
Example #11
0
        public async void PageContent()
        {
            try
            {
                StackLayout mainLayout = new StackLayout
                {
                    Padding = new Thickness(10, 10, 10, 10)
                };

                mainLayout.Children.Clear();

                BusStopList = new ListView
                {
                    SeparatorColor    = Color.White,
                    BackgroundColor   = Color.White,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    VerticalOptions   = LayoutOptions.FillAndExpand,
                    HeightRequest     = 250
                };

                BusStopList.ItemTapped += BusStopList_ItemTapped;

                activityIndicator = new ActivityIndicator
                {
                    IsRunning = true,
                    IsVisible = true
                };


                DataTemplate dt = new DataTemplate(() =>
                {
                    Label stopName = new Label
                    {
                        HorizontalOptions = LayoutOptions.FillAndExpand,
                        TextColor         = Color.Black,
                        FontSize          = 20
                    };

                    stopName.SetBinding(Label.TextProperty, "StopName");

                    StackLayout layout = new StackLayout
                    {
                        HorizontalOptions = LayoutOptions.FillAndExpand,
                        VerticalOptions   = LayoutOptions.FillAndExpand
                    };

                    layout.SetBinding(BackgroundColorProperty, new Binding("BackColor"));
                    layout.Children.Add(stopName);

                    var menuFrame = new Frame
                    {
                        Margin    = 5,
                        HasShadow = true,
                        Content   = layout
                    };

                    menuFrame.SetBinding(BackgroundColorProperty, new Binding("BackColor"));

                    return(new ViewCell {
                        View = menuFrame
                    });
                });

                BusStopList.RowHeight    = 100;
                BusStopList.ItemTemplate = dt;
                BusStopList.Refreshing  += BusStopList_Refreshing;

                mainLayout.Children.Add(activityIndicator);
                mainLayout.Children.Add(BusStopList);

                CurrentPage.Content = mainLayout;
            }
            catch (Exception ex)
            {
                await DisplayAlert("Error", ex.Message, "OK");
            }
        }
Example #12
0
        // [recursive down] create item template instances, attach and layout, and set descendents until finding overrides
        protected void BuildVisualChildren( )
        {
            var bindingContextNode = (ITreeNode)BindingContext;

            if (bindingContextNode == null)
            {
                return;
            }
            // STEP 1: remove child visual tree nodes (TreeNodeViews) that don't correspond to an item in our data source

            var nodeViewsToRemove = new List <TreeNodeView> ( );

            var bindingChildList = new List <ITreeNode> (bindingContextNode != null ? bindingContextNode.ChildNodes : null);

            // which ChildTreeNodeViews are in the visual tree... ?
            foreach (TreeNodeView nodeView in ChildTreeNodeViews)
            {
                // but missing from the bound data source?
                if (!bindingChildList.Contains(nodeView.BindingContext))
                {
                    // tag them for removal from the visual tree
                    nodeViewsToRemove.Add(nodeView);
                }
            }

            BatchBegin( );
            try {
                // perform removal in a batch
                foreach (TreeNodeView nodeView in nodeViewsToRemove)
                {
                    _childrenStackLayout.Children.Remove(nodeView);
                }
            } finally {
                // ensure we commit
                BatchCommit( );
            }

            // STEP 2: add visual tree nodes (TreeNodeViews) for children of the binding context not already associated with a TreeNodeView

            if (NodeCreationFactory != null)
            {
                var nodeViewsToAdd = new Dictionary <TreeNodeView, ITreeNode> ( );

                foreach (ITreeNode node in bindingContextNode.ChildNodes)
                {
                    if (!ChildTreeNodeViews.Any(nodeView => nodeView.BindingContext == node))
                    {
                        var nodeView = NodeCreationFactory.Invoke( );
                        nodeView.ParentTreeNodeView = this;

                        if (HeaderCreationFactory != null)
                        {
                            nodeView.HeaderContent = HeaderCreationFactory.Invoke(node);
                        }

                        // the order of these may be critical
                        nodeViewsToAdd.Add(nodeView, node);
                    }
                }

                BatchBegin( );
                try {
                    // perform the additions in a batch
                    foreach (KeyValuePair <TreeNodeView, ITreeNode> nodeView in nodeViewsToAdd)
                    {
                        // only set BindingContext after the node has Parent != null
                        nodeView.Key.BindingContext = nodeView.Value;
                        nodeView.Value.ExpandAction = () => nodeView.Key.BuildVisualChildren( );
                        nodeView.Key._childrenStackLayout.IsVisible = nodeView.Key.IsExpanded;
                        _childrenStackLayout.Children.Add(nodeView.Key);

                        _childrenStackLayout.SetBinding(StackLayout.IsVisibleProperty, new Binding("IsExpanded", BindingMode.TwoWay));

                        // TODO: make sure to unsubscribe elsewhere
                        nodeView.Value.PropertyChanged += HandleListCountChanged;
                    }
                } finally {
                    // ensure we commit
                    BatchCommit( );
                }
            }
        }
Example #13
0
        public ChatRoomView()
        {
            InitializeComponent();

            NavigationPage.SetHasNavigationBar(this, false);

            /*ChatView = new ChatListView (){
             *                  BackgroundColor = Color.FromHex ("#EEEEEE"),
             *                  HorizontalOptions=LayoutOptions.FillAndExpand,
             *                  VerticalOptions=LayoutOptions.FillAndExpand
             *          };
             *          ChatView.SetBinding (ChatListView.ItemsSourceProperty, "Messages");//SelectedMessage
             *          ChatView.SetBinding (ChatListView.SelectedItemProperty, "SelectedMessage",BindingMode.TwoWay); */
            ChatView = new ChatListView()
            {
                BackgroundColor   = Color.FromHex("#EEEEEE"),
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                // IsGroupingEnabled = true,
                //GroupDisplayBinding = new Binding("MessageDate"),
                //  GroupShortNameBinding = new Binding ("MessageDate"),

                //  GroupDisplayBinding = new Binding("MessageDate"),
            };

            ChatView.SetBinding(ChatListView.ItemsSourceProperty, "Messages");//SelectedMessage
            ChatView.SetBinding(ChatListView.SelectedItemProperty, "SelectedMessage", BindingMode.TwoWay);

            MyEntry messageEntry = new MyEntry {
                Placeholder       = "Type your message here",
                FontSize          = 14,
                HeightRequest     = 25,
                HorizontalOptions = LayoutOptions.FillAndExpand
            };

            messageEntry.SetBinding(Entry.TextProperty, "YourMessage");

            Image sendImg = new Image {
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                Source            = ImageSource.FromFile("send.png"),
                Aspect            = Aspect.AspectFit
            };

            StackLayout sendBtn = new StackLayout()
            {
                HeightRequest     = 25,
                WidthRequest      = 25,
                HorizontalOptions = LayoutOptions.End,
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                Children          =
                {
                    sendImg
                }
            };

            sendBtn.SetBinding(StackLayout.IsVisibleProperty, "CanEnableSendBtn");
            sendBtn.GestureRecognizers.Add(new TapGestureRecognizer((v, o) => {
                ((ChatRoomViewModel)this.BindingContext).SendCmd.Execute(null);
            }));

            ChatMessage.Children.Add(ChatView);
            ChatRoom.Children.Add(new StackLayout {
                BackgroundColor = Color.White,
                HeightRequest   = 40,
                Spacing         = 0,
                VerticalOptions = LayoutOptions.End,
                Orientation     = StackOrientation.Horizontal,
                Padding         = new Thickness(10, 10, 10, 10),
                Children        =
                {
                    messageEntry,
                    sendBtn
                }
            });

//			ChatRoom
        }
Example #14
0
        public MainMenu()
        {
            this.Title          = "CT - Main Menu";
            this.BindingContext = new MainMenuViewModel();


            var iCTLogo = new Image
            {
                HeightRequest     = 50,
                HorizontalOptions = LayoutOptions.StartAndExpand,
                VerticalOptions   = LayoutOptions.Fill,
                Source            = "CT_logo_sm.png"
            };

            var iMenu = new Image
            {
                HeightRequest     = 40,
                HorizontalOptions = LayoutOptions.EndAndExpand,
                VerticalOptions   = LayoutOptions.Fill,
                Source            = "menu_alt.png"
            };

            iMenu.GestureRecognizers.Add(new TapGestureRecognizer((obj) => {
                vm.IsMenuVisible = !vm.IsMenuVisible;
            }));

            var stackHeader = new StackLayout
            {
                HorizontalOptions = LayoutOptions.Fill,
                VerticalOptions   = LayoutOptions.Fill,
                IsClippedToBounds = true,
                Orientation       = StackOrientation.Horizontal,
                Padding           = new Thickness(0, 0, 0, 5),
                Children          = { iCTLogo, iMenu }
            };


            var lblTitleGreetings = new Label
            {
                HorizontalOptions       = LayoutOptions.Fill,
                HorizontalTextAlignment = TextAlignment.Center,
                FontSize = 16,
                Text     = "Welcome Mr John Doe (Referrer, T1)"
            };

            CTIconHome   icoHome   = new CTIconHome();
            CTIconHelp   icoHelp   = new CTIconHelp();
            CTIconLogout icoLogout = new CTIconLogout();

            var bxvTop = new BoxView
            {
                HeightRequest     = 2,
                HorizontalOptions = LayoutOptions.Fill,
                Color             = Color.FromHex(Constants.HEX_LINE_MENU),
                Margin            = new Thickness(0, 5, 0, 0)
            };

            var bxvBottom = new BoxView
            {
                HeightRequest     = 2,
                HorizontalOptions = LayoutOptions.Fill,
                Color             = Color.FromHex(Constants.HEX_LINE_MENU),
                Margin            = new Thickness(0, 0, 0, 30)
            };

            var bxvLeftHome = new BoxView
            {
                WidthRequest    = 2,
                VerticalOptions = LayoutOptions.Fill,
                Color           = Color.FromHex(Constants.HEX_LINE_MENU)
            };

            var bxvLeftHelp = new BoxView
            {
                WidthRequest    = 2,
                VerticalOptions = LayoutOptions.Fill,
                Color           = Color.FromHex(Constants.HEX_LINE_MENU)
            };

            var bxvLeftLogout = new BoxView
            {
                WidthRequest    = 2,
                VerticalOptions = LayoutOptions.Fill,
                Color           = Color.FromHex(Constants.HEX_LINE_MENU)
            };

            var stackMenu = new StackLayout
            {
                HeightRequest     = 40,
                HorizontalOptions = LayoutOptions.End,
                VerticalOptions   = LayoutOptions.Fill,
                IsClippedToBounds = true,
                Orientation       = StackOrientation.Horizontal,
                Children          =
                {
                    bxvLeftHome,   icoHome.View,
                    bxvLeftHelp,   icoHelp.View,
                    bxvLeftLogout, icoLogout.View
                }
            };

            stackMenu.SetBinding(IsVisibleProperty, new Binding("IsMenuVisible"));

            var lblTitleSection = new Label
            {
                HorizontalOptions       = LayoutOptions.Fill,
                HorizontalTextAlignment = TextAlignment.Start,
                Margin         = new Thickness(10, 0, 10, 20),
                FontSize       = 20,
                FontAttributes = FontAttributes.Bold,
                Text           = "Main menu (Referrer)"
            };

            var viewTemplate = new DataTemplate(typeof(CTMenuItem));

            var lvMenu = new ListView
            {
                HasUnevenRows = true,
                ItemTemplate  = viewTemplate
            };

            lvMenu.SetBinding(ItemsView <Cell> .ItemsSourceProperty, new Binding("MenuItems"));
            lvMenu.ItemTapped += (sender, e) =>
            {
                if (e == null)
                {
                    return;
                }
                ((ListView)sender).SelectedItem = null;

                MainMenuItem mmi   = e.Item as MainMenuItem;
                string[]     items = mmi.text.Split("/".ToCharArray());

                bool     activar = true;
                string[] source  = lsvDetailItem.ItemsSource == null ? new string[0] : (string[])lsvDetailItem.ItemsSource;

                if (Enumerable.SequenceEqual(source, items))
                {
                    activar = false;
                    items   = null;
                }

                ActivateModalDetailItem(activar, items);
            };

            var btnWebVersion = new Button
            {
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Fill,
                Text = "Go to web app..."
            };

            btnWebVersion.Command = new Command((obj) => {
                ((NavigationPage)Application.Current.MainPage).PushAsync(new CTWebView());
            });

            StackLayout stackContentMainMenu = new StackLayout
            {
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.Fill,
                BackgroundColor   = Color.White,
                Padding           = new Thickness(4),
                Spacing           = 0,
                Children          =
                {
                    stackHeader,
                    //lblTitleGreetings,
                    bxvTop,
                    stackMenu,
                    bxvBottom,
                    lblTitleSection,
                    lvMenu,
                    btnWebVersion
                }
            };

            AbsoluteLayout.SetLayoutFlags(stackContentMainMenu, AbsoluteLayoutFlags.All);
            AbsoluteLayout.SetLayoutBounds(stackContentMainMenu, new Rectangle(0, 0, 1, 1));

            ConfigModalDetailItem();

            ScrollView scrollModalDetailItem = new ScrollView
            {
                IsClippedToBounds = true,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Padding           = new Thickness(20),
                Content           = stackContenidoModalCorreo
            };

            Image iBackgroundModal = new Image
            {
                Source           = "Transparencia.png",
                Aspect           = Aspect.AspectFill,
                InputTransparent = true
            };

            AbsoluteLayout.SetLayoutFlags(iBackgroundModal, AbsoluteLayoutFlags.All);
            AbsoluteLayout.SetLayoutBounds(iBackgroundModal, new Rectangle(0, 0, 1, 1));

            //AbsoluteLayout.SetLayoutFlags(scrollModalDetailItem, AbsoluteLayoutFlags.All);
            //AbsoluteLayout.SetLayoutBounds(scrollModalDetailItem, new Rectangle(0, 0, 1, 1));

            AbsoluteLayout.SetLayoutFlags(stackContenidoModalCorreo, AbsoluteLayoutFlags.All);
            AbsoluteLayout.SetLayoutBounds(stackContenidoModalCorreo, new Rectangle(0, 0, 1, 1));

            absoluteModalDetailItem = new AbsoluteLayout
            {
                Padding           = new Thickness(0),
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                InputTransparent  = false,
                IsVisible         = false,
                Children          =
                {
                    iBackgroundModal,
                    //scrollModalDetailItem
                    stackContenidoModalCorreo
                }
            };

            AbsoluteLayout.SetLayoutFlags(absoluteModalDetailItem, AbsoluteLayoutFlags.All);
            AbsoluteLayout.SetLayoutBounds(absoluteModalDetailItem, new Rectangle(0, 0, 1, 1));

            StackLayout stackMainMenu = new StackLayout
            {
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Fill,
                Spacing           = 0,
                Children          =
                {
                    stackContentMainMenu,
                    absoluteModalDetailItem
                }
            };

            Content = stackMainMenu;
        }
Example #15
0
        /// <summary>
        /// re paint the schedule
        /// </summary>
        private void ArrangeSchedule()
        {
            var schedule = GetSchedule(this);

            if (schedule == null || schedule.ScheduleItemList == null)
            {
                return;
            }

            var list = gridSchedule.Children.Where(m => m.GetType() == typeof(StackLayout)).ToList();

            foreach (var item in list)
            {
                gridSchedule.Children.Remove(item);
            }

            for (int i = 0; i < schedule.ScheduleItemList.Count; i++)
            {
                var item = schedule.ScheduleItemList[i];
                if (item.BeginWeek <= schedule.SelectedWeekIndex + 1 && item.EndWeek >= schedule.SelectedWeekIndex + 1)
                {
                    if (item.Parity != null)
                    {
                        if ((schedule.SelectedWeekIndex + 1) % 2 != item.Parity)
                        {
                            continue;
                        }
                    }
                    StackLayout layout = new StackLayout();
                    layout.Orientation = StackOrientation.Vertical;

                    layout.BackgroundColor = BlockColors[item.CourseId % BlockColors.Count];

                    layout.SetValue(Grid.RowProperty, item.BeginClass);
                    layout.SetValue(Grid.ColumnProperty, item.WeekDay);
                    layout.SetValue(Grid.RowSpanProperty, item.EndClass - item.BeginClass + 1);


                    layout.HorizontalOptions = LayoutOptions.FillAndExpand;
                    layout.BindingContext    = item;

                    Label title = new Label {
                        Text = item.CourseName, FontSize = 10, TextColor = new Color(1, 1, 1), HorizontalOptions = LayoutOptions.CenterAndExpand, HorizontalTextAlignment = TextAlignment.Center
                    };
                    Label room = new Label {
                        Text = item.Room, FontSize = 8, TextColor = new Color(1, 1, 1), HorizontalOptions = LayoutOptions.CenterAndExpand, HorizontalTextAlignment = TextAlignment.Center
                    };

                    layout.Children.Add(title);
                    layout.Children.Add(room);


                    var binding = new Binding();
                    binding.Path = "ItemClickedCommand";
                    binding.Mode = BindingMode.OneWay;

                    layout.BindingContext = this.BindingContext;
                    layout.SetBinding(ClickedCommandProperty, binding);


                    layout.GestureRecognizers.Add(new TapGestureRecognizer {
                        Command = (ICommand)layout.GetValue(ClickedCommandProperty), CommandParameter = item
                    });

                    gridSchedule.Children.Add(layout);
                }
            }
        }
Example #16
0
        public NomineesPage()
        {
            BindingContext = new NomineesPageViewModel(DependencyService.Get <IAppNavService>());
            var nomineeList = new ListView
            {
                HasUnevenRows = true,
                ItemTemplate  = new DataTemplate(typeof(NomineesPageDataTemplate))
            };

            switch (Device.RuntimePlatform)
            {
            case Device.iOS:
                nomineeList.SeparatorColor = Color.Default;
                break;

            default:
                nomineeList.SeparatorColor = Color.Black;
                break;
            }

            nomineeList.SetBinding(ItemsView <Cell> .ItemsSourceProperty, "Nominees");
            nomineeList.SetBinding(ItemsView <Cell> .IsVisibleProperty, "IsProcessBusy", converter: new BooleanConverter());

            //declare our progress lable
            var progressLabel = new Label()
            {
                FontSize                = 14,
                FontAttributes          = FontAttributes.Bold,
                TextColor               = Color.Black,
                HorizontalTextAlignment = TextAlignment.Center,
                Text = "Loading Nominees List...."
            };

            //instantiate an initialise our activity indicator
            var activityIndicator = new ActivityIndicator()
            {
                IsRunning = true
            };
            var progessIndicator = new StackLayout
            {
                Orientation       = StackOrientation.Vertical,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                Children          =
                {
                    activityIndicator,
                    progressLabel
                }
            };

            progessIndicator.SetBinding(StackLayout.IsVisibleProperty, "IsProcessBusy");

            var mainLayout = new StackLayout
            {
                Children =
                {
                    nomineeList,
                    progessIndicator
                }
            };

            Content = mainLayout;
        }
        private void LlenarGrillaDeMovimientos(List <string[]> movimientos)
        {
            var esTeclaPar       = false;
            var listaMovimientos = new List <ClaseMovimiento>();

            //Usamos for para ordenar los movimientos por fecha en forma descendente
            for (var indice = movimientos.Count - 1; indice >= 0; indice--)
            {
                var datosMovimiento = movimientos[indice];
                //Sólo incluimos los movimientos (no eliminados) del producto seleccionado
                if (datosMovimiento[1] != _productoString[0] || datosMovimiento[datosMovimiento.Length - 2] == "Sí")
                {
                    continue;
                }

                var datosParaVer = new List <string>();
                var i            = -1;
                foreach (var dato in datosMovimiento)
                {
                    i += 1;
                    //No incluimos Código y Nombre del producto, tampoco Eliminado y Eliminado Por porque son los movimientos (no eliminados) del producto seleccionado.
                    if (i == 1 || i == 2 || i == datosMovimiento.Length - 2 || i == datosMovimiento.Length - 1)
                    {
                        continue;
                    }

                    datosParaVer.Add(_nombresColumnas[i] + " : " + dato);
                }

                var movimiento = new ClaseMovimiento(indice + 2, datosParaVer, esTeclaPar);
                listaMovimientos.Add(movimiento);
                esTeclaPar = !esTeclaPar;
            }

            var anchoColumnaEliminar = App.AnchoRetratoDePantalla / 6;
            var anchoColumnaDatos    = anchoColumnaEliminar * 5;
            var vista = new ListView
            {
                RowHeight         = 100,
                VerticalOptions   = LayoutOptions.StartAndExpand,
                HorizontalOptions = LayoutOptions.Fill,
                ItemsSource       = listaMovimientos,
                ItemTemplate      = new DataTemplate(() =>
                {
                    // Datos
                    var datos = new Label
                    {
                        FontSize        = 15,
                        TextColor       = Color.FromHex("#1D1D1B"),
                        VerticalOptions = LayoutOptions.CenterAndExpand,
                        WidthRequest    = anchoColumnaDatos
                    };
                    datos.SetBinding(Label.TextProperty, "Datos");

                    // Separador
                    var separador = new BoxView
                    {
                        WidthRequest    = 2,
                        BackgroundColor = Color.FromHex("#FFFFFF"),
                        HeightRequest   = 55
                    };

                    // Botón eliminar
                    var etiquetaIconoEliminar = new Label
                    {
                        FontFamily = "FontAwesome5Solid.otf#Regular",
                        HorizontalTextAlignment = TextAlignment.Center,
                        FontSize              = 22,
                        TextColor             = Color.FromHex("#ffffff"),
                        VerticalTextAlignment = TextAlignment.Center,
                        VerticalOptions       = LayoutOptions.EndAndExpand,
                        Text = "\uf2ed"
                    };

                    var etiquetaEliminar = new Label
                    {
                        HorizontalTextAlignment = TextAlignment.Center,
                        FontSize              = 14,
                        TextColor             = Color.FromHex("#ffffff"),
                        VerticalTextAlignment = TextAlignment.Center,
                        VerticalOptions       = LayoutOptions.StartAndExpand,
                        Text = "Eliminar"
                    };

                    var contenedorEliminar = new StackLayout
                    {
                        WidthRequest    = anchoColumnaEliminar,
                        Orientation     = StackOrientation.Vertical,
                        Children        = { etiquetaIconoEliminar, etiquetaEliminar },
                        BackgroundColor = Color.FromHex("#FD8A18")
                    };
                    contenedorEliminar.SetBinding(ClassIdProperty, "IdMovimiento");
                    contenedorEliminar.GestureRecognizers.Add(new TapGestureRecognizer(EliminarMovimiento));

                    // Teja
                    var tecla = new StackLayout
                    {
                        Padding     = 2,
                        Spacing     = 2,
                        Orientation = StackOrientation.Horizontal,
                        Children    = { datos, separador, contenedorEliminar }
                    };
                    tecla.SetBinding(BackgroundColorProperty, "ColorFondo");

                    return(new ViewCell {
                        View = tecla
                    });
                })
            };

            ContenedorMovimientos.Children.Clear();
            ContenedorMovimientos.Children.Add(vista);
        }
Example #18
0
        public ExpensesViewCell()
        {
            var topGrid = new Grid
            {
                WidthRequest    = App.ScreenSize.Width,
                VerticalOptions = LayoutOptions.Center,
                HeightRequest   = 36
            };

            topGrid.ColumnDefinitions = new ColumnDefinitionCollection
            {
                new ColumnDefinition {
                    Width = App.ScreenSize.Width * .75
                },
                new ColumnDefinition {
                    Width = GridLength.Auto
                }
            };

            var lblDistance = new Label
            {
                FontSize   = 28,
                FontFamily = Helper.RegFont,
                TextColor  = Color.White
            };

            lblDistance.SetBinding(Label.TextProperty, new Binding("Miles", converter: new DoubleToOneDpString()));

            var imgSelected = new Image
            {
                WidthRequest = 40
            };

            imgSelected.SetBinding(Image.SourceProperty, new Binding("ImageName"));
            imgSelected.SetBinding(Image.ClassIdProperty, new Binding("JourneyId"));
            imgSelected.GestureRecognizers.Add(new TapGestureRecognizer
            {
                NumberOfTapsRequired = 1,
                Command = new Command(() => MessagingCenter.Send(this, "Selected", imgSelected.ClassId))
            });

            var imgNotifications = new Image
            {
                Source        = "main_menu_notifications".CorrectedImageSource(),
                HeightRequest = 32
            };

            imgSelected.SetBinding(Image.ClassIdProperty, new Binding("JourneyId"));
            imgNotifications.GestureRecognizers.Add(new TapGestureRecognizer
            {
                NumberOfTapsRequired = 1,
                Command = new Command(() => MessagingCenter.Send(this, "Notifications", imgNotifications.ClassId))
            });
            imgNotifications.SetBinding(Image.IsVisibleProperty, new Binding("HasNotifications"));

            imgSelected.BindingContextChanged += (sender, e) =>
            {
                var bc = BindingContext as ExpenseModel;
                if (bc != null)
                {
                    imgSelected.Source = bc.ImageName.CorrectedImageSource();
                }
            };

            var lblSelect = new Label
            {
                FontFamily = Helper.RegFont,
                FontSize   = 16
            };

            lblSelect.SetBinding(Label.TextProperty, new Binding("SelectedText"));
            lblSelect.SetBinding(Label.ClassIdProperty, new Binding("JourneyId"));

            var distStack = new StackLayout
            {
                Orientation = StackOrientation.Horizontal,
                Padding     = new Thickness(8, 0, 0, 0),
                Children    =
                {
                    lblDistance,
                    new Label {
                        Text = Langs.Const_Label_Miles,FontSize                         = 28, FontFamily = Helper.RegFont
                    },
                    new StackLayout
                    {
                        Padding  = new Thickness(12, 0),
                        Children = { imgNotifications }
                    }
                }
            };

            var selectStack = new StackLayout
            {
                Orientation = StackOrientation.Horizontal,
                Padding     = new Thickness(0, 0, 0, 8),
                Children    = { lblSelect, imgSelected }
            };

            topGrid.Children.Add(distStack, 0, 0);
            topGrid.Children.Add(selectStack, 1, 0);

            var grid = new Grid
            {
                WidthRequest      = App.ScreenSize.Width,
                HorizontalOptions = LayoutOptions.Start
            };

            grid.ColumnDefinitions = new ColumnDefinitionCollection
            {
                new ColumnDefinition {
                    Width = App.ScreenSize.Width * .2
                },
                new ColumnDefinition {
                    Width = App.ScreenSize.Width * .5
                },
                new ColumnDefinition {
                    Width = App.ScreenSize.Width * .2
                },
                new ColumnDefinition {
                    Width = App.ScreenSize.Width * .1
                }
            };
            grid.RowDefinitions = new RowDefinitionCollection
            {
                new RowDefinition {
                    Height = 24
                },
                new RowDefinition {
                    Height = GridLength.Auto
                },
                new RowDefinition {
                    Height = 24
                },
            };

            var lblJourneyType = new Label
            {
                TextColor  = Color.White,
                FontFamily = Helper.RegFont,
                FontSize   = 10
            };

            lblJourneyType.SetBinding(Label.TextProperty, new Binding("JourneyType"));

            var lblRegistration = new Label
            {
                TextColor  = Color.White,
                FontFamily = Helper.RegFont,
                FontSize   = 10
            };

            lblRegistration.SetBinding(Label.TextProperty, new Binding("Registration"));

            var lblScore = new Label
            {
                TextColor             = Color.White,
                FontSize              = 24,
                HeightRequest         = 60,
                VerticalTextAlignment = TextAlignment.Center,
                FontFamily            = Helper.RegFont
            };

            lblScore.SetBinding(Label.BackgroundColorProperty, new Binding("OverallScore", converter: new ScoreToColor()));
            lblScore.SetBinding(Label.TextProperty, new Binding("OverallScore"));

            var lblStartTime = new Label
            {
                TextColor  = Color.White,
                FontFamily = Helper.BoldFont,
                FontSize   = 10
            };

            lblStartTime.SetBinding(Label.TextProperty, new Binding("StartTime"));

            var lblArriveTime = new Label
            {
                TextColor  = Color.White,
                FontFamily = Helper.BoldFont,
                FontSize   = 10
            };

            lblArriveTime.SetBinding(Label.TextProperty, new Binding("EndTime"));

            var lblDepartPlace = new Label
            {
                TextColor  = Color.White,
                FontFamily = Helper.RegFont,
                FontSize   = 10
            };

            lblDepartPlace.SetBinding(Label.TextProperty, new Binding("StartLocation"));

            var lblArrivePlace = new Label
            {
                TextColor  = Color.White,
                FontFamily = Helper.RegFont,
                FontSize   = 10
            };

            lblArrivePlace.SetBinding(Label.TextProperty, new Binding("EndLocation"));



            var stackOutTime = new StackLayout
            {
                Orientation     = StackOrientation.Horizontal,
                VerticalOptions = LayoutOptions.CenterAndExpand,
                Children        =
                {
                    new Image {
                        Source = "radio_off_light".CorrectedImageSource(), HeightRequest = 20
                    },
                    lblStartTime
                }
            };
            var stackInTime = new StackLayout
            {
                Orientation     = StackOrientation.Horizontal,
                VerticalOptions = LayoutOptions.CenterAndExpand,
                Children        =
                {
                    new Image {
                        Source = "radio_on_light".CorrectedImageSource(), HeightRequest = 20
                    },
                    lblArriveTime
                }
            };

            var imgNext = new Image
            {
                Source        = "ic_keyboard_arrow_right_white_24dp".CorrectedImageSource(),
                HeightRequest = 32
            };

            imgNext.SetBinding(Image.ClassIdProperty, new Binding("MapviewId"));
            imgNext.GestureRecognizers.Add(new TapGestureRecognizer
            {
                NumberOfTapsRequired = 1,
                Command = new Command(() => MessagingCenter.Send(this, "JourneyId", imgNext.ClassId))
            });

            var stackNextArrow = new StackLayout
            {
                VerticalOptions   = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.Start,
                Children          = { imgNext }
            };

            var stackScore = new StackLayout
            {
                VerticalOptions   = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.Center,
                Children          = { lblScore }
            };

            stackScore.SetBinding(Label.BackgroundColorProperty, new Binding("OverallScore", converter: new ScoreToColor()));

            var imgViewAll = new Image
            {
                Source        = "ic_keyboard_arrow_right_white_24dp".CorrectedImageSource(),
                HeightRequest = 20
            };
            var lblViewAll = new Label
            {
                TextColor  = Color.White,
                FontFamily = Helper.RegFont,
                FontSize   = 10,
                Text       = Langs.Const_Button_View_All_Journeys
            };

            grid.Children.Add(lblJourneyType, 0, 0);
            grid.Children.Add(lblRegistration, 1, 0);
            grid.Children.Add(stackScore, 2, 1);
            grid.Children.Add(stackNextArrow, 3, 1);

            grid.Children.Add(stackOutTime, 0, 1);
            grid.Children.Add(lblDepartPlace, 1, 1);

            grid.Children.Add(stackInTime, 0, 2);
            grid.Children.Add(lblArrivePlace, 1, 2);

            Grid.SetRowSpan(stackScore, 3);
            Grid.SetRowSpan(stackNextArrow, 3);

            View = new StackLayout
            {
                WidthRequest    = App.ScreenSize.Width,
                BackgroundColor = FormsConstants.AppySeaBlue,
                Children        =
                {
                    topGrid,
                    new BoxView {
                        HeightRequest = 1,WidthRequest                = App.ScreenSize.Width, BackgroundColor = Color.Transparent
                    },
                    grid
                }
            };
        }
Example #19
0
        public MainPage()
        {
            Title          = "Mail Stats";
            model          = new MainPageViewModel();
            BindingContext = model;
            var style = new Style(typeof(Button))
            {
                Setters =
                {
                    new Setter {
                        Property = Button.HeightRequestProperty,
                        Value    = Device.OnPlatform(30, 45, 45)
                    },
                    new Setter {
                        Property = Button.BackgroundColorProperty,
                        Value    = Color.White
                    }
                }
            };

            Device.OnPlatform(Android: () => BackgroundColor = Color.White);

            Resources = new ResourceDictionary();
            Resources.Add(style);

            var template = new DataTemplate(typeof(ScoreboardEntryCell));
            var listView = new ListView {
                ItemTemplate   = template,
                RowHeight      = 36,
                HeaderTemplate = new DataTemplate(typeof(ScoreboardHeader)),
                HeightRequest  = 10
            };

            listView.SetBinding(ListView.ItemsSourceProperty, "ScoreBoard");
            listView.VerticalOptions = LayoutOptions.FillAndExpand;

            listView.HeaderTemplate = new DataTemplate(typeof(HeaderView));

            listView.Header = model;

            var indicator = new ActivityIndicator();

            indicator.IsRunning = true;

            var statusLabel = new Label {
                FontSize        = 10,
                VerticalOptions = LayoutOptions.CenterAndExpand
            };

            statusLabel.SetBinding(Label.TextProperty, "StatusText");

            var statusLayout = new StackLayout {
                Orientation     = StackOrientation.Horizontal,
                BackgroundColor = Color.White,
                Padding         = 5,
                Children        =
                {
                    indicator,
                    statusLabel
                }
            };

            statusLayout.SetBinding(StackLayout.IsVisibleProperty, "IsRunning");

            var grid = new Grid {
                RowDefinitions =
                {
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    },
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Auto)
                    }
                },
            };

            grid.Children.Add(listView, 0, 1, 0, 2);
            grid.Children.Add(statusLayout, 0, 1, 1, 2);

            Content = grid;
        }
Example #20
0
        private void InitTabs()
        {
            _headerContainerGrid.Children.Clear();
            _headerContainerGrid.ColumnDefinitions.Clear();
            _headerContainerGrid.RowDefinitions.Clear();

            var tabSize = (TabSizeOption.IsAbsolute && TabSizeOption.Value.Equals(0)) ? new GridLength(1, GridUnitType.Star) : TabSizeOption;

            for (int i = 0; i < ItemSource.Count; i++)
            {
                if (i > 0)
                {
                    _headerContainerGrid.ColumnDefinitions.Add(new ColumnDefinition()
                    {
                        Width = new GridLength(TabSpacing, GridUnitType.Absolute)
                    });
                }
                _headerContainerGrid.ColumnDefinitions.Add(new ColumnDefinition()
                {
                    Width = tabSize
                });

                var tab = ItemSource[i];
                tab.IsCurrent = i == _position;

                var headerLabel = new Label
                {
                    Margin                  = new Thickness(0, 0, 0, 2),
                    BindingContext          = tab,
                    VerticalTextAlignment   = TextAlignment.Start,
                    HorizontalTextAlignment = TextAlignment.Center,
                    HorizontalOptions       = LayoutOptions.CenterAndExpand,
                    VerticalOptions         = LayoutOptions.Center
                };
                headerLabel.SetBinding(Label.TextProperty, "HeaderText");
                headerLabel.SetBinding(Label.TextColorProperty, "HeaderTextColor");
                headerLabel.SetBinding(Label.FontSizeProperty, "HeaderTabTextFontSize");
                headerLabel.SetBinding(Label.FontFamilyProperty, "HeaderTabTextFontFamily");
                headerLabel.SetBinding(Label.FontAttributesProperty, "HeaderTabTextFontAttributes");

                var selectionBarBoxView = new BoxView
                {
                    HorizontalOptions = LayoutOptions.Fill,
                    VerticalOptions   = LayoutOptions.EndAndExpand,
                    BindingContext    = tab,
                    HeightRequest     = HeaderSelectionUnderlineThickness,
                    WidthRequest      = HeaderSelectionUnderlineWidth
                };
                selectionBarBoxView.SetBinding(BoxView.IsVisibleProperty, "IsCurrent");
                selectionBarBoxView.SetBinding(BoxView.ColorProperty, "HeaderSelectionUnderlineColor");
                selectionBarBoxView.SetBinding(BoxView.WidthProperty, "HeaderSelectionUnderlineWidth");
                selectionBarBoxView.SetBinding(BoxView.HeightProperty, "HeaderSelectionUnderlineThickness");

                selectionBarBoxView.PropertyChanged += (object sender, PropertyChangedEventArgs e) =>
                {
                    if (e.PropertyName == "IsCurrent")
                    {
                        SetPosition(ItemSource.IndexOf((TabItem)((BoxView)sender).BindingContext));
                    }
                };

                var selectionBarContainer = new StackLayout
                {
                    HorizontalOptions = LayoutOptions.Fill,
                    VerticalOptions   = LayoutOptions.End,
                    BindingContext    = tab,
                    WidthRequest      = HeaderSelectionUnderlineWidth,
                    Children          = { selectionBarBoxView },
                    Spacing           = 0
                };
                selectionBarContainer.SetBinding(BoxView.WidthProperty, "HeaderSelectionUnderlineWidth");

                var headerItemSL = new StackLayout
                {
                    HorizontalOptions = LayoutOptions.Fill,
                    VerticalOptions   = LayoutOptions.FillAndExpand,
                    Children          = { headerLabel, selectionBarContainer },
                    Spacing           = 0
                };

                var tapRecognizer = new TapGestureRecognizer();
                int capturedIndex = i;
                tapRecognizer.Tapped += (object s, EventArgs e) =>
                {
                    _supressCarouselViewPositionChangedEvent = true;
                    SetPosition(capturedIndex);
                    _supressCarouselViewPositionChangedEvent = false;
                };
                headerItemSL.GestureRecognizers.Add(tapRecognizer);

                _headerContainerGrid.Children.Add(headerItemSL, i * 2, 0);
            }

            _carouselView.ItemsSource = ItemSource.Select(t => t.Content).ToArray();
        }
        public DiscountItemTemplate()
        {
            var gridDiscountItem = new Grid
            {
                RowDefinitions =
                {
                    new RowDefinition {
                        Height = GridLength.Auto
                    },
                    new RowDefinition {
                        Height = GridLength.Auto
                    },
                    new RowDefinition {
                        Height = GridLength.Star
                    }
                },
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = GridLength.Auto
                    },
                    new ColumnDefinition {
                        Width = GridLength.Star
                    },
                    new ColumnDefinition {
                        Width = GridLength.Auto
                    }
                }
            };

            ImgCompanyLogo = new CachedImage
            {
                WidthRequest         = 64,
                HeightRequest        = 64,
                Aspect               = Aspect.AspectFit,
                DownsampleToViewSize = true,
                ErrorPlaceholder     = "img_empty_small.png"
            };

            gridDiscountItem.Children.Add(ImgCompanyLogo, 0, 1, 0, 3);

            var txtTitle = new Label
            {
                VerticalOptions = LayoutOptions.End,
                Style           = LabelStyles.ListTitleStyle.FromResources <Style>()
            };

            txtTitle.SetBinding(Label.TextProperty, "Name");

            gridDiscountItem.Children.Add(txtTitle, 1, 0);

            #region Percent label

            var spanDiscountPercent = new Span();
            spanDiscountPercent.SetBinding(Span.TextProperty, "DiscountPercent");

            var spanDiscountType = new Span();
            spanDiscountType.SetBinding(Span.TextProperty, "DiscountType");

            var txtPercent = new Label
            {
                Style           = LabelStyles.ListPercentStyle.FromResources <Style>(),
                VerticalOptions = LayoutOptions.End,
                FormattedText   = new FormattedString
                {
                    Spans =
                    {
                        spanDiscountPercent,
                        spanDiscountType
                    }
                }
            };

            gridDiscountItem.Children.Add(txtPercent, 2, 0);

            #endregion

            #region Category layout

            var categoriesLayout = new StackLayout
            {
                Spacing     = 5,
                Orientation = StackOrientation.Horizontal
            };

            var categoryItemTemplate = new DataTemplate(typeof(CategoryItemTemplate));
            BindableLayout.SetItemTemplate(categoriesLayout, categoryItemTemplate);

            categoriesLayout.SetBinding(BindableLayout.ItemsSourceProperty, "CategoryList");

            gridDiscountItem.Children.Add(categoriesLayout, 1, 3, 1, 2);

            #endregion

            #region Description

            var txtDescription = new Label
            {
                Style    = LabelStyles.DescriptionStyle.FromResources <Style>(),
                MaxLines = 3
            };
            txtDescription.SetBinding(Label.TextProperty, "Description");

            gridDiscountItem.Children.Add(txtDescription, 1, 3, 2, 3);

            #endregion

            var boxBorder = new Frame
            {
                Margin          = new Thickness(8, 4),
                Padding         = 8,
                CornerRadius    = 1,
                BackgroundColor = MainStyles.ListBackgroundColor.FromResources <Color>(),
                BorderColor     = MainStyles.ListBorderColor.FromResources <Color>(),
                HasShadow       = false,
                Content         = gridDiscountItem
            };

            View = boxBorder;
        }
Example #22
0
        public PicturePage()
        {
            _viewModel     = new PictureViewModel();
            BindingContext = _viewModel;

            this.SetBinding(TitleProperty, nameof(_viewModel.PageTitle));
            BackgroundColor = Color.FromHex("#91E2F4");

            _photo1ScoreButton = new BounceButton(AutomationIdConstants.ScoreButton1);
            _photo1ScoreButton.SetBinding(IsEnabledProperty, nameof(_viewModel.IsScore1ButtonEnabled));
            _photo1ScoreButton.SetBinding(IsVisibleProperty, nameof(_viewModel.IsScore1ButtonVisable));
            _photo1ScoreButton.SetBinding(Button.TextProperty, nameof(_viewModel.ScoreButton1Text));
            _photo1ScoreButton.SetBinding(Button.CommandProperty, nameof(_viewModel.Photo1ScoreButtonPressed));

            var photo1ScoreButtonStack = new StackLayout
            {
                Padding  = new Thickness(24, 24, 24, 24),
                Children =
                {
                    _photo1ScoreButton
                }
            };

            #region Create Score Button 2 Stack
            _photo2ScoreButton = new BounceButton(AutomationIdConstants.ScoreButton2);
            _photo2ScoreButton.SetBinding(IsEnabledProperty, nameof(_viewModel.IsScore2ButtonEnabled));
            _photo2ScoreButton.SetBinding(IsVisibleProperty, nameof(_viewModel.IsScore2ButtonVisable));
            _photo2ScoreButton.SetBinding(Button.TextProperty, nameof(_viewModel.ScoreButton2Text));
            _photo2ScoreButton.SetBinding(Button.CommandProperty, nameof(_viewModel.Photo2ScoreButtonPressed));

            var photo2ScoreButtonStack = new StackLayout
            {
                Padding  = new Thickness(24, 24, 24, 24),
                Children =
                {
                    _photo2ScoreButton
                }
            };
            #endregion

            #region Create Photo Activity Indicators
            var photo1ActivityIndicator = new ActivityIndicator
            {
                AutomationId = AutomationIdConstants.Photo1ActivityIndicator
            };
            photo1ActivityIndicator.SetBinding(IsVisibleProperty, nameof(_viewModel.IsCalculatingPhoto1Score));
            photo1ActivityIndicator.SetBinding(ActivityIndicator.IsRunningProperty, nameof(_viewModel.IsCalculatingPhoto1Score));

            var photo2ActivityIndicator = new ActivityIndicator
            {
                AutomationId = AutomationIdConstants.Photo2ActivityIndicator
            };
            photo2ActivityIndicator.SetBinding(IsVisibleProperty, nameof(_viewModel.IsCalculatingPhoto2Score));
            photo2ActivityIndicator.SetBinding(ActivityIndicator.IsRunningProperty, nameof(_viewModel.IsCalculatingPhoto2Score));
            #endregion

            #region Create Photo 1 Button Stack
            var takePhoto1Button = new BounceButton(AutomationIdConstants.TakePhoto1Button)
            {
                Text = "Take Photo"
            };
            takePhoto1Button.SetBinding(IsEnabledProperty, nameof(_viewModel.IsTakeLeftPhotoButtonEnabled));
            takePhoto1Button.SetBinding(Button.CommandProperty, nameof(_viewModel.TakePhoto1ButtonPressed));

            var player1NameLabel = new DarkBlueLabel
            {
                Text = Settings.Player1Name,
                HorizontalOptions = LayoutOptions.Center
            };

            var takePhoto1ButtonStack = new StackLayout
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Padding           = new Thickness(24, 24, 24, 24),
                Children          =
                {
                    player1NameLabel,
                    takePhoto1Button
                }
            };
            takePhoto1ButtonStack.SetBinding(IsVisibleProperty, nameof(_viewModel.IsTakeLeftPhotoButtonStackVisible));
            #endregion

            #region Create Photo 2 Button Stack
            var takePhoto2Button = new BounceButton(AutomationIdConstants.TakePhoto2Button)
            {
                Text = "Take Photo"
            };
            takePhoto2Button.SetBinding(IsEnabledProperty, nameof(_viewModel.IsTakeRightPhotoButtonEnabled));
            takePhoto2Button.SetBinding(Button.CommandProperty, nameof(_viewModel.TakePhoto2ButtonPressed));

            var player2NameLabel = new DarkBlueLabel
            {
                Text = Settings.Player2Name,
                HorizontalOptions = LayoutOptions.Center,
            };

            var takePhoto2ButtonStack = new StackLayout
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Padding           = new Thickness(24, 24, 24, 24),
                Children          =
                {
                    player2NameLabel,
                    takePhoto2Button
                }
            };
            takePhoto2ButtonStack.SetBinding(IsVisibleProperty, nameof(_viewModel.IsTakeRightPhotoButtonStackVisible));
            #endregion

            #region Create Photo Image Containers
            _photoImage1 = new FrameImage(AutomationIdConstants.PhotoImage1);
            _photoImage1.SetBinding(IsVisibleProperty, nameof(_viewModel.IsPhotoImage1Enabled));
            _photoImage1.ContentImage.SetBinding(Image.SourceProperty, nameof(_viewModel.Photo1ImageSource));

            _photoImage2 = new FrameImage(AutomationIdConstants.PhotoImage2);
            _photoImage2.SetBinding(IsVisibleProperty, nameof(_viewModel.IsPhotoImage2Enabled));
            _photoImage2.ContentImage.SetBinding(Image.SourceProperty, nameof(_viewModel.Photo2ImageSource));
            #endregion

            #region Create Photo 1 Stack
            var photo1Stack = new StackLayout
            {
                Style    = StylesConstants.StackLayoutStyle,
                Children =
                {
                    _photoImage1,
                    photo1ScoreButtonStack,
                    photo1ActivityIndicator
                },
            };
            #endregion

            #region Create Photo 2 Stack
            var photo2Stack = new StackLayout
            {
                Style    = StylesConstants.StackLayoutStyle,
                Children =
                {
                    _photoImage2,
                    photo2ScoreButtonStack,
                    photo2ActivityIndicator
                }
            };
            #endregion

            #region Create Reset Button Stack
            var resetButton = new BounceButton(AutomationIdConstants.ResetButton)
            {
                Text = "Reset"
            };
            resetButton.SetBinding(IsEnabledProperty, nameof(_viewModel.IsResetButtonEnabled));
            resetButton.SetBinding(IsVisibleProperty, nameof(_viewModel.IsResetButtonEnabled));
            resetButton.SetBinding(Button.CommandProperty, nameof(_viewModel.ResetButtonPressed));

            var resetButtonStack = new StackLayout
            {
                Padding  = new Thickness(24, 24, 24, 24),
                Children =
                {
                    resetButton
                }
            };
            #endregion

            #region Create Relative Laout
            var buttonImageRelativeLayout = new RelativeLayout();

            buttonImageRelativeLayout.Children.Add(photo1Stack,
                                                   Constraint.RelativeToParent(parent => parent.X + _frameImagePadding),
                                                   Constraint.RelativeToParent(parent => parent.Y + _frameImagePadding),
                                                   Constraint.RelativeToParent(parent => parent.Width / 2 - 2 * _frameImagePadding),
                                                   Constraint.RelativeToParent(parent => parent.Height * 7 / 8)
                                                   );

            buttonImageRelativeLayout.Children.Add(photo2Stack,
                                                   Constraint.RelativeToParent(parent => parent.Width / 2 + _frameImagePadding),
                                                   Constraint.RelativeToParent(parent => parent.Y + _frameImagePadding),
                                                   Constraint.RelativeToParent(parent => parent.Width / 2 - 2 * _frameImagePadding),
                                                   Constraint.RelativeToParent(parent => parent.Height * 7 / 8)
                                                   );

            buttonImageRelativeLayout.Children.Add(takePhoto1ButtonStack,
                                                   Constraint.RelativeToParent(parent => parent.X),
                                                   Constraint.RelativeToParent(parent => parent.Y),
                                                   Constraint.RelativeToParent(parent => parent.Width / 2)
                                                   );

            buttonImageRelativeLayout.Children.Add(takePhoto2ButtonStack,
                                                   Constraint.RelativeToParent(parent => parent.Width / 2),
                                                   Constraint.RelativeToParent(parent => parent.Y),
                                                   Constraint.RelativeToParent(parent => parent.Width / 2)
                                                   );

            buttonImageRelativeLayout.Children.Add(resetButtonStack,
                                                   Constraint.RelativeToParent(parent => parent.X),
                                                   Constraint.RelativeToParent(parent => parent.Height * 7 / 8 - resetButtonStack.Height),
                                                   Constraint.RelativeToParent(parent => parent.Width),
                                                   Constraint.RelativeToParent(parent => parent.Height * 1 / 8)
                                                   );
            #endregion

            #region Set Page Content


            Content = new ScrollView
            {
                Content = buttonImageRelativeLayout
            };
            #endregion
        }
Example #23
0
        public StatsResultsPageViewCell()
        {
            var titleLabel = new Label {
                VerticalOptions = LayoutOptions.CenterAndExpand,
                TextColor       = Color.FromHex(Theme.Current.StatisticsDetailsTitleColor),
                Style           = AppStyles.GetLabelStyle()
            };

            titleLabel.SetBinding(Label.TextProperty, "Title");
            titleLabel.SetBinding(VisualElement.IsVisibleProperty, "IsTitle");

            var dateIcon = new CachedImage {
                VerticalOptions = LayoutOptions.CenterAndExpand,
                Source          = ImageSource.FromFile(Theme.Current.StatisticsCalendarIcon),
                HeightRequest   = _iconSize,
                WidthRequest    = _iconSize,
                Transformations = new List <FFImageLoading.Work.ITransformation> {
                    new TintTransformation {
                        EnableSolidColor = true,
                        HexColor         = Theme.Current.StatisticsDetailsColor
                    }
                }
            };

            var dateLabel = new Label {
                VerticalOptions = LayoutOptions.CenterAndExpand,
                TextColor       = Color.FromHex(Theme.Current.StatisticsDetailsColor),
                Style           = AppStyles.GetLabelStyle(NamedSize.Small)
            };

            dateLabel.SetBinding(Label.TextProperty, "Date");

            var dateLayout = new StackLayout {
                Orientation     = StackOrientation.Horizontal,
                VerticalOptions = LayoutOptions.CenterAndExpand,
                Children        =
                {
                    dateIcon,
                    dateLabel
                }
            };

            dateLayout.SetBinding(VisualElement.IsVisibleProperty, "IsDate");

            var commentIcon = new CachedImage {
                VerticalOptions = LayoutOptions.StartAndExpand,
                Source          = ImageSource.FromFile(Theme.Current.StatisticsCommentIcon),
                HeightRequest   = _iconSize,
                WidthRequest    = _iconSize,
                Transformations = new List <FFImageLoading.Work.ITransformation> {
                    new TintTransformation {
                        EnableSolidColor = true,
                        HexColor         = Theme.Current.StatisticsDetailsColor
                    }
                }
            };

            var commentLabel = new Label {
                VerticalOptions = LayoutOptions.CenterAndExpand,
                TextColor       = Color.FromHex(Theme.Current.StatisticsDetailsColor),
                Style           = AppStyles.GetLabelStyle(NamedSize.Small)
            };

            commentLabel.SetBinding(Label.TextProperty, "Comment");

            var commentLayout = new StackLayout {
                Orientation     = StackOrientation.Horizontal,
                VerticalOptions = LayoutOptions.CenterAndExpand,
                Children        =
                {
                    commentIcon,
                    commentLabel
                }
            };

            commentLayout.SetBinding(VisualElement.IsVisibleProperty, "IsComment");

            var infoLayout = new StackLayout {
                VerticalOptions = LayoutOptions.StartAndExpand,
                Spacing         = _infoSpacing,
                Children        =
                {
                    titleLabel,
                    dateLayout,
                    commentLayout
                }
            };

            var resultLabel = new Label {
                TextColor         = Color.FromHex(Theme.Current.StatisticsDetailsResultsColor),
                HorizontalOptions = LayoutOptions.EndAndExpand,
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                Style             = AppStyles.GetLabelStyle(NamedSize.Large)
            };

            resultLabel.SetBinding(Label.TextProperty, "Result");

            var gridLayout = new Grid {
                Padding           = _gridPadding,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = new GridLength(2, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    }
                }
            };

            gridLayout.Children.Add(infoLayout, 0, 0);
            gridLayout.Children.Add(resultLabel, 1, 0);

            View = new StackLayout {
                BackgroundColor = Color.FromHex(Theme.Current.BaseBlockColor),
                Children        =
                {
                    gridLayout
                }
            };
        }
Example #24
0
        protected override void Init()
        {
            var people = new ObservableCollection <Person> {
                new Person("Abigail", new DateTime(1975, 1, 15), Color.Aqua),
                new Person("Bob", new DateTime(1976, 2, 20), Color.Black),
                new Person("Cathy", new DateTime(1977, 3, 10), Color.Blue),
#pragma warning disable 618
                new Person("David", new DateTime(1978, 4, 25), Color.Fuschia),
#pragma warning restore 618
            };

            var buttonAdd = new Button
            {
                Text = "Add",
                HorizontalOptions = LayoutOptions.Start,
                VerticalOptions   = LayoutOptions.Center,
            };

            var buttonRemove = new Button
            {
                Text = "Remove",
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
            };

            var buttonScrollToBottom = new Button
            {
                Text = "Bottom",
                HorizontalOptions = LayoutOptions.Start,
                VerticalOptions   = LayoutOptions.Center,
            };

            var buttonStack = new StackLayout
            {
                Orientation = StackOrientation.Horizontal,
                Children    =
                {
                    buttonAdd,
                    buttonRemove,
                    buttonScrollToBottom,
                }
            };

            var listView = new ListView
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                ItemsSource       = people,
                ItemTemplate      = new DataTemplate(() =>
                {
                    var nameLabel     = new Label();
                    var birthdayLabel = new Label();
                    var boxView       = new BoxView();

                    var stack = new StackLayout
                    {
                        Padding         = new Thickness(0, 5),
                        Orientation     = StackOrientation.Horizontal,
                        BackgroundColor = Color.Black,
                        Children        =
                        {
                            boxView,
                            new StackLayout {
                                VerticalOptions = LayoutOptions.Center,
                                Spacing         = 0,
                                Children        =
                                {
                                    nameLabel,
                                    birthdayLabel
                                }
                            }
                        }
                    };

                    nameLabel.SetBinding(Label.TextProperty, "Name");
                    birthdayLabel.SetBinding(Label.TextProperty, new Binding("Birthday", BindingMode.OneWay, null, null, "Born {0:d}"));
                    boxView.SetBinding(BoxView.ColorProperty, "FavoriteColor");
                    stack.SetBinding(BackgroundColorProperty, "BackgroundColor");

                    return(new ViewCell
                    {
                        View = stack
                    });
                })
            };

            buttonAdd.Clicked += (sender, e) =>
            {
                var person = new Person(string.Format("Name {0}", _count++), DateTime.Today, Color.Blue);

                people.Add(person);

                listView.ScrollTo(person, ScrollToPosition.End, true);
            };

            buttonRemove.Clicked += (sender, e) => people.RemoveAt(people.Count - 1);

            buttonScrollToBottom.Clicked += (sender, e) =>
            {
                var person = people[people.Count - 1];

                listView.ScrollTo(person, ScrollToPosition.End, true);
            };

            Padding = Device.RuntimePlatform == Device.iOS ? new Thickness(10, 20, 10, 5) : new Thickness(10, 0, 10, 5);

            Content = new StackLayout
            {
                Orientation = StackOrientation.Vertical,
                Children    =
                {
                    buttonStack,
                    listView,
                }
            };
        }
Example #25
0
        public FaceOffPage()
        {
            this.SetBinding(TitleProperty, nameof(ViewModel.PageTitle));

            _photo1ScoreButton = new BounceButton(AutomationIdConstants.ScoreButton1)
            {
                Padding = new Thickness(24, 12)
            };
            _photo1ScoreButton.SetBinding(IsEnabledProperty, nameof(ViewModel.IsScore1ButtonEnabled));
            _photo1ScoreButton.SetBinding(IsVisibleProperty, nameof(ViewModel.IsScore1ButtonVisable));
            _photo1ScoreButton.SetBinding(Button.TextProperty, nameof(ViewModel.ScoreButton1Text));
            _photo1ScoreButton.SetBinding(Button.CommandProperty, nameof(ViewModel.Photo1ScoreButtonPressed));

            _photo2ScoreButton = new BounceButton(AutomationIdConstants.ScoreButton2)
            {
                Padding = new Thickness(24, 12)
            };
            _photo2ScoreButton.SetBinding(IsEnabledProperty, nameof(ViewModel.IsScore2ButtonEnabled));
            _photo2ScoreButton.SetBinding(IsVisibleProperty, nameof(ViewModel.IsScore2ButtonVisable));
            _photo2ScoreButton.SetBinding(Button.TextProperty, nameof(ViewModel.ScoreButton2Text));
            _photo2ScoreButton.SetBinding(Button.CommandProperty, nameof(ViewModel.Photo2ScoreButtonPressed));

            var photo1ActivityIndicator = new ActivityIndicator {
                AutomationId = AutomationIdConstants.Photo1ActivityIndicator
            };

            photo1ActivityIndicator.SetBinding(IsVisibleProperty, nameof(ViewModel.IsCalculatingPhoto1Score));
            photo1ActivityIndicator.SetBinding(ActivityIndicator.IsRunningProperty, nameof(ViewModel.IsCalculatingPhoto1Score));

            var photo2ActivityIndicator = new ActivityIndicator {
                AutomationId = AutomationIdConstants.Photo2ActivityIndicator
            };

            photo2ActivityIndicator.SetBinding(IsVisibleProperty, nameof(ViewModel.IsCalculatingPhoto2Score));
            photo2ActivityIndicator.SetBinding(ActivityIndicator.IsRunningProperty, nameof(ViewModel.IsCalculatingPhoto2Score));

            var takePhoto1Button = new BounceButton(AutomationIdConstants.TakePhoto1Button)
            {
                Text = "Take Photo"
            };

            takePhoto1Button.SetBinding(IsEnabledProperty, nameof(ViewModel.IsTakeLeftPhotoButtonEnabled));
            takePhoto1Button.SetBinding(Button.CommandProperty, nameof(ViewModel.TakePhoto1ButtonPressed));

            var player1NameLabel = new DarkBlueLabel
            {
                Text = PreferencesService.Player1Name,
                HorizontalOptions = LayoutOptions.Center
            };

            var takePhoto1ButtonStack = new StackLayout
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Padding           = new Thickness(24, 24, 24, 24),
                Children          =
                {
                    player1NameLabel,
                    takePhoto1Button
                }
            };

            takePhoto1ButtonStack.SetBinding(IsVisibleProperty, nameof(ViewModel.IsTakeLeftPhotoButtonStackVisible));

            var takePhoto2Button = new BounceButton(AutomationIdConstants.TakePhoto2Button)
            {
                Text = "Take Photo"
            };

            takePhoto2Button.SetBinding(IsEnabledProperty, nameof(ViewModel.IsTakeRightPhotoButtonEnabled));
            takePhoto2Button.SetBinding(Button.CommandProperty, nameof(ViewModel.TakePhoto2ButtonPressed));

            var player2NameLabel = new DarkBlueLabel
            {
                Text = PreferencesService.Player2Name,
                HorizontalOptions = LayoutOptions.Center,
            };

            var takePhoto2ButtonStack = new StackLayout
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Padding           = new Thickness(24, 24, 24, 24),
                Children          =
                {
                    player2NameLabel,
                    takePhoto2Button
                }
            };

            takePhoto2ButtonStack.SetBinding(IsVisibleProperty, nameof(ViewModel.IsTakeRightPhotoButtonStackVisible));

            _photoImage1 = new FrameImage(AutomationIdConstants.PhotoImage1);
            _photoImage1.SetBinding(IsVisibleProperty, nameof(ViewModel.IsPhotoImage1Enabled));
            _photoImage1.ContentImage.SetBinding(Image.SourceProperty, nameof(ViewModel.Photo1ImageSource));

            _photoImage2 = new FrameImage(AutomationIdConstants.PhotoImage2);
            _photoImage2.SetBinding(IsVisibleProperty, nameof(ViewModel.IsPhotoImage2Enabled));
            _photoImage2.ContentImage.SetBinding(Image.SourceProperty, nameof(ViewModel.Photo2ImageSource));

            var photo1Stack = new StackLayout
            {
                Style    = StylesConstants.StackLayoutStyle,
                Children =
                {
                    _photoImage1,
                    _photo1ScoreButton,
                    photo1ActivityIndicator
                }
            };

            var photo2Stack = new StackLayout
            {
                Style    = StylesConstants.StackLayoutStyle,
                Children =
                {
                    _photoImage2,
                    _photo2ScoreButton,
                    photo2ActivityIndicator
                }
            };

            var resetButton = new BounceButton(AutomationIdConstants.ResetButton)
            {
                Text = "Reset"
            };

            resetButton.SetBinding(IsEnabledProperty, nameof(ViewModel.IsResetButtonEnabled));
            resetButton.SetBinding(IsVisibleProperty, nameof(ViewModel.IsResetButtonEnabled));
            resetButton.SetBinding(Button.CommandProperty, nameof(ViewModel.ResetButtonPressed));

            var resetButtonStack = new StackLayout
            {
                Padding  = new Thickness(24, 24, 24, 24),
                Children =
                {
                    resetButton
                }
            };

            var buttonImageRelativeLayout = new RelativeLayout();

            buttonImageRelativeLayout.Children.Add(photo1Stack,
                                                   Constraint.RelativeToParent(parent => parent.X + _frameImagePadding),
                                                   Constraint.RelativeToParent(parent => parent.Y + _frameImagePadding),
                                                   Constraint.RelativeToParent(parent => parent.Width / 2 - 2 * _frameImagePadding),
                                                   Constraint.RelativeToParent(parent => parent.Height * 7 / 8)
                                                   );

            buttonImageRelativeLayout.Children.Add(photo2Stack,
                                                   Constraint.RelativeToParent(parent => parent.Width / 2 + _frameImagePadding),
                                                   Constraint.RelativeToParent(parent => parent.Y + _frameImagePadding),
                                                   Constraint.RelativeToParent(parent => parent.Width / 2 - 2 * _frameImagePadding),
                                                   Constraint.RelativeToParent(parent => parent.Height * 7 / 8)
                                                   );

            buttonImageRelativeLayout.Children.Add(takePhoto1ButtonStack,
                                                   Constraint.RelativeToParent(parent => parent.X),
                                                   Constraint.RelativeToParent(parent => parent.Y),
                                                   Constraint.RelativeToParent(parent => parent.Width / 2)
                                                   );

            buttonImageRelativeLayout.Children.Add(takePhoto2ButtonStack,
                                                   Constraint.RelativeToParent(parent => parent.Width / 2),
                                                   Constraint.RelativeToParent(parent => parent.Y),
                                                   Constraint.RelativeToParent(parent => parent.Width / 2)
                                                   );

            buttonImageRelativeLayout.Children.Add(resetButtonStack,
                                                   Constraint.RelativeToParent(parent => parent.X),
                                                   Constraint.RelativeToParent(parent => parent.Height * 7 / 8 - resetButtonStack.Height),
                                                   Constraint.RelativeToParent(parent => parent.Width),
                                                   Constraint.RelativeToParent(parent => parent.Height * 1 / 8)
                                                   );

            Content = buttonImageRelativeLayout;
        }
        private View getView()
        {
            _lblCorso = new Label()
            {
                FontSize  = Device.GetNamedSize(NamedSize.Default, this),
                TextColor = ColorHelper.Blue700,
                //HorizontalOptions = LayoutOptions.FillAndExpand
            };
            _lblCorso.SetBinding(Label.TextProperty, "Insegnamento");

            _lblCodice = new Label()
            {
                FontSize          = Device.GetNamedSize(NamedSize.Micro, this),
                TextColor         = ColorHelper.Gray,
                HorizontalOptions = LayoutOptions.EndAndExpand,
            };
            _lblCodice.SetBinding(Label.TextProperty, "Codice");

            _lblAula = new Label()
            {
                FontSize  = Device.GetNamedSize(NamedSize.Small, this),
                TextColor = ColorHelper.Gray,
                //HorizontalOptions = LayoutOptions.FillAndExpand
            };
            _lblAula.SetBinding(Label.TextProperty, "Aula");

            _lblOra = new Label()
            {
                FontSize          = Device.GetNamedSize(NamedSize.Small, this),
                TextColor         = ColorHelper.Gray,
                HorizontalOptions = LayoutOptions.FillAndExpand,
            };
            _lblOra.SetBinding(Label.TextProperty, "Ora");

            _lblDocente = new Label()
            {
                FontSize          = Device.GetNamedSize(NamedSize.Small, this),
                FontAttributes    = Xamarin.Forms.FontAttributes.Bold,
                TextColor         = Color.Black,
                HorizontalOptions = LayoutOptions.EndAndExpand,
            };
            _lblDocente.SetBinding(Label.TextProperty, "Docente");

            _lblNote = new Label()
            {
                FontSize          = Device.GetNamedSize(NamedSize.Small, this),
                TextColor         = Color.Black,
                HorizontalOptions = LayoutOptions.StartAndExpand,
            };
            _lblNote.SetBinding(Label.TextProperty, "Note");
            _lblNote.SetBinding(Label.IsVisibleProperty, new Binding("Note", converter: new NoteIsVisibleConverter()));
            _lblNote.SetBinding(Label.TextColorProperty, new Binding("Note", converter: new NoteBackgroundConverter()));

            //lblOra.SetBinding(Label.TextColorProperty, new Binding("Note", converter: new NoteBackgroundConverter()));
            //lblAula.SetBinding(Label.TextColorProperty, new Binding("Note", converter: new NoteBackgroundConverter()));

            var grid = new Grid()
            {
                BackgroundColor   = ColorHelper.White,
                Padding           = new Thickness(10, 10, 10, 10),
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                RowSpacing        = 0,
                ColumnSpacing     = 5,

                RowDefinitions =
                {
                    new RowDefinition {
                        Height = GridLength.Auto
                    },
                    new RowDefinition {
                        Height = GridLength.Auto
                    },
                    new RowDefinition {
                        Height = GridLength.Auto
                    },
                    new RowDefinition {
                        Height = GridLength.Auto
                    },
                },
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                }
            };

            //grid.SetBinding(Grid.BackgroundColorProperty, new Binding("Note", converter: new NoteBackgroundConverter()));

            grid.Children.Add(_lblCorso, 0, 2, 0, 1);
            //grid.Children.Add(_lblCodice, 1, 2, 0, 1);
            grid.Children.Add(_lblAula, 0, 1, 1, 2);
            grid.Children.Add(_lblCodice, 1, 2, 1, 2);
            grid.Children.Add(_lblOra, 0, 1, 2, 3);
            grid.Children.Add(_lblDocente, 1, 2, 2, 3);
            grid.Children.Add(_lblNote, 0, 2, 3, 4);

            var layoutInt = new StackLayout()
            {
                Padding         = new Thickness(6, 0, 0, 0),
                HeightRequest   = grid.Height,
                VerticalOptions = LayoutOptions.FillAndExpand,
            };

            layoutInt.SetBinding(StackLayout.BackgroundColorProperty, new Binding("Note", converter: new NoteBackgroundConverter()));
            layoutInt.Children.Add(grid);

            var layoutExt = new StackLayout()
            {
                Padding         = new Thickness(0, 3, 0, 3),
                BackgroundColor = ColorHelper.Transparent,
            };

            layoutExt.Children.Add(layoutInt);

            return(layoutExt);
        }
Example #27
0
        protected override void Init()
        {
            StackLayout parentLayout1 = null;
            StackLayout parentLayout2 = null;
            StackLayout parentLayout3 = null;

            StackLayout stackLayout = new StackLayout
            {
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
                BackgroundColor   = Color.Blue,
                Children          =
                {
                    new BoxView
                    {
                        Color         = Color.Red,
                        HeightRequest = 100,
                        WidthRequest  = 100,
                    }
                }
            };

            ContentView contentView = new ContentView
            {
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
                BackgroundColor   = Color.Blue,
                Content           =
                    new BoxView
                {
                    Color         = Color.Red,
                    HeightRequest = 100,
                    WidthRequest  = 100,
                }
            };

            FlexLayout flex = new FlexLayout
            {
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
                BackgroundColor   = Color.Blue,
                Children          =
                {
                    new BoxView
                    {
                        Color         = Color.Red,
                        HeightRequest = 100,
                        WidthRequest  = 100,
                    }
                }
            };

            Slider paddingSlider = new Slider
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Minimum           = 0.0,
                Maximum           = 100.0,
            };

            stackLayout.SetBinding(Forms.Layout.PaddingProperty, new Binding()
            {
                Path = "Value", Source = paddingSlider
            });
            contentView.SetBinding(Forms.Layout.PaddingProperty, new Binding()
            {
                Path = "Value", Source = paddingSlider
            });
            flex.SetBinding(Forms.Layout.PaddingProperty, new Binding()
            {
                Path = "Value", Source = paddingSlider
            });

            // Build the page.
            this.Padding = new Thickness(20);
            this.Content = new StackLayout
            {
                Spacing  = 20,
                Children =
                {
                    new StackLayout
                    {
                        Orientation = StackOrientation.Horizontal,
                        Children    =
                        {
                            new Label
                            {
                                Text = "Padding"
                            },
                            paddingSlider,
                        }
                    },
                    new Button()
                    {
                        Text    = "Force update",
                        Command = new Command(() =>
                        {
                            var boxview = new BoxView();
                            parentLayout1.Children.Add(boxview);
                            parentLayout1.Children.Remove(boxview);
                            parentLayout2.Children.Add(boxview);
                            parentLayout2.Children.Remove(boxview);
                            parentLayout3.Children.Add(boxview);
                            parentLayout3.Children.Remove(boxview);
                        })
                    },
                    new ScrollView
                    {
                        HorizontalOptions = LayoutOptions.FillAndExpand,
                        VerticalOptions   = LayoutOptions.FillAndExpand,
                        Content           = new StackLayout
                        {
                            Spacing  = 20,
                            Children =
                            {
                                (parentLayout1            = new StackLayout
                                {
                                    Children              ={ new Label                {
                                                   Text = "StackLayout"
                                               }, stackLayout },
                                }),
                                (parentLayout2            = new StackLayout
                                {
                                    Children              ={ new Label                {
                                                   Text = "ContentView"
                                               }, contentView }
                                }),
                                (parentLayout3            = new StackLayout
                                {
                                    Children              ={ new Label                {
                                                   Text = "FlexLayout"
                                               }, flex }
                                })
                            }
                        }
                    }
                }
            };
        }
Example #28
0
			public MenuCell ()
			{
				Label textLabel = new Label {
					FontSize = 18,
				};

				textLabel.SetBinding (Label.TextProperty, "Title");
				var root = new StackLayout {
					Padding = new Thickness (12, 8),
					Children = { textLabel }
				};
				root.SetBinding (BackgroundColorProperty, "Background");
				View = root;
			}
        private StackLayout CreateDiaryItem(DiaryItemViewModel viewModel)
        {
            var diaryItemRootLayout = new StackLayout {
                Spacing = 0, Margin = 0, Orientation = StackOrientation.Vertical
            };

            diaryItemRootLayout.BindingContext = viewModel;

            var headerLayout = new StackLayout {
                Spacing = 0, Orientation = StackOrientation.Horizontal
            };

            var leftSideLayout = new StackLayout {
                Orientation = StackOrientation.Vertical, Margin = 10, HorizontalOptions = LayoutOptions.FillAndExpand
            };

            var lblDate = new Label
            {
                HorizontalOptions = LayoutOptions.StartAndExpand,
                FontSize          = (double)App.Current.Resources["ListFontSize"],
                TextColor         = (Color)App.Current.Resources["PrimaryDarkColor"]
            };

            lblDate.SetBinding(Label.TextProperty, "Date");
            leftSideLayout.Children.Add(lblDate);

            var lblSectorNames = new Label
            {
                FontSize  = 15,
                TextColor = (Color)App.Current.Resources["PrimaryDarkColor"]
            };

            lblSectorNames.SetBinding(Label.TextProperty, "SectorNames");
            leftSideLayout.Children.Add(lblSectorNames);
            headerLayout.Children.Add(leftSideLayout);

            var lblNumberOfRoutes = new Label
            {
                FontSize = 15,
                VerticalTextAlignment = TextAlignment.Center,
                TextColor             = (Color)App.Current.Resources["PrimaryDarkColor"]
            };

            lblNumberOfRoutes.SetBinding(Label.TextProperty, "NumberOfRoutes");
            headerLayout.Children.Add(lblNumberOfRoutes);

            var expandIcon = new Image
            {
                Margin            = new Thickness(15, 10),
                VerticalOptions   = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.End,
                Aspect            = Aspect.AspectFit,
                Source            = "ic_expand_more_blue.png"
            };

            headerLayout.Children.Add(expandIcon);

            diaryItemRootLayout.Children.Add(headerLayout);

            var expandedLayout = new StackLayout {
                Orientation = StackOrientation.Vertical, HorizontalOptions = LayoutOptions.FillAndExpand, Spacing = 0
            };

            foreach (var diary in viewModel.ListOfSameDateDiaries)
            {
                var routeLayout = new StackLayout
                {
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    Spacing           = 0,
                    Orientation       = StackOrientation.Horizontal
                };

                var dotIcon = new Image
                {
                    Margin          = new Thickness(15, 10, 10, 10),
                    VerticalOptions = LayoutOptions.Center,
                    Aspect          = Aspect.AspectFit,
                    Source          = "ic_dot_blue.png"
                };
                routeLayout.Children.Add(dotIcon);

                var lblDiaryText = new Label
                {
                    Margin = new Thickness(0, 0, 10, 0),
                    VerticalTextAlignment = TextAlignment.Center,
                    HorizontalOptions     = LayoutOptions.FillAndExpand,
                    TextColor             = (Color)App.Current.Resources["PrimaryDarkColor"],
                    Text = diary.DiaryText
                };
                var tgrRouteDetail = new TapGestureRecognizer();
                tgrRouteDetail.Tapped += async(sender, args) =>
                {
                    await Navigation.PushAsync(new RouteDetailPage(diary.Route));
                };
                lblDiaryText.GestureRecognizers.Add(tgrRouteDetail);
                routeLayout.Children.Add(lblDiaryText);

                var editIcon = new Image
                {
                    Margin          = new Thickness(10),
                    VerticalOptions = LayoutOptions.Center,
                    Aspect          = Aspect.AspectFit,
                    Source          = "ic_edit_blue.png"
                };
                var tgrEditDiary = new TapGestureRecognizer();
                tgrEditDiary.Tapped += async(sender, args) =>
                {
                    await Navigation.PushAsync(new AddDiaryPage(diary.Route, diary.Diary));
                };
                editIcon.GestureRecognizers.Add(tgrEditDiary);
                routeLayout.Children.Add(editIcon);

                var deleteIcon = new Image
                {
                    Margin          = new Thickness(10),
                    VerticalOptions = LayoutOptions.Center,
                    Aspect          = Aspect.AspectFit,
                    Source          = "ic_delete_red.png"
                };
                var tgrDeleteDiary = new TapGestureRecognizer();
                tgrDeleteDiary.Tapped += (sender, args) =>
                {
                    DependencyService.Get <IDialogs>().ShowDialog(AppResources.DiaryDeleteDialog_Title, AppResources.DiaryDeleteDialog_Message, AppResources.Ok, AppResources.Cancel, async(sender2, args2) =>
                    {//smazání cesty z deníčku
                        await App.Database.DeleteDiary(diary.Diary);
                        this.CreateDiariesView();
                    }, (sender3, args3) =>
                    {
                        //zrušení dialogu - nic neděláme
                    });
                };
                deleteIcon.GestureRecognizers.Add(tgrDeleteDiary);
                routeLayout.Children.Add(deleteIcon);

                expandedLayout.Children.Add(routeLayout);
            }

            diaryItemRootLayout.Children.Add(expandedLayout);
            expandedLayout.SetBinding(StackLayout.IsVisibleProperty, new Binding("Expanded"));

            var tgrExpand = new TapGestureRecognizer();

            tgrExpand.Tapped += async(s, e) =>
            {
                if (viewModel.Expanded)
                {
                    expandIcon.RotateTo(0);
                    await expandedLayout.FadeTo(0, 500);

                    viewModel.Expanded = false;
                }
                else
                {
                    viewModel.Expanded = true;
                    expandIcon.RotateTo(180);
                    expandedLayout.FadeTo(1, 500);
                }
                this.RootScrollView.ScrollToAsync(diaryItemRootLayout, ScrollToPosition.Start, true);
            };
            headerLayout.GestureRecognizers.Add(tgrExpand);

            var separator = new BoxView
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                HeightRequest     = (double)App.Current.Resources["SeparatorHeight"],
                BackgroundColor   = (Color)App.Current.Resources["PrimaryColor"]
            };

            diaryItemRootLayout.Children.Add(separator);

            return(diaryItemRootLayout);
        }