Exemplo n.º 1
0
        private void AddContent()
        {
            LayoutHelpers.AddToolBarItems(this.ToolbarItems, this.listPageCollectionViewModel.Buttons);
            Title = this.listPageCollectionViewModel.FormSettings.Title;

            Content = new Grid
            {
                Children =
                {
                    (
                        page                 = new StackLayout
                    {
                        Padding              = new Thickness(30),
                        Children             =
                        {
                            new Label
                            {
                                Style        = LayoutHelpers.GetStaticStyleResource("HeaderStyle")
                            }
                            .AddBinding(Label.TextProperty, new Binding(nameof(ListPageCollectionViewModelBase.Title))),
                            new CollectionView
                            {
                                Style        = LayoutHelpers.GetStaticStyleResource("ListFormCollectionViewStyle"),
                                ItemTemplate = LayoutHelpers.GetCollectionViewItemTemplate
                                               (
                                    this.listPageCollectionViewModel.FormSettings.ItemTemplateName,
                                    this.listPageCollectionViewModel.FormSettings.Bindings
                                               )
                            }
                            .AddBinding(ItemsView.ItemsSourceProperty, new Binding(nameof(ListPageCollectionViewModel <Domain.EntityModelBase> .Items)))
                        }
                    }
                    ),
                    (
                        transitionGrid       = new Grid().AssignDynamicResource
                                               (
                            VisualElement.BackgroundColorProperty,
                            "PageBackgroundColor"
                                               )
                    )
                }
            };
        }
        public ReadOnlyChildFormArrayPageCS(IReadOnly formArrayReadOnly)
        {
            this.formArrayReadOnly = formArrayReadOnly;
            this.formsCollectionDisplayTemplateDescriptor = (FormsCollectionDisplayTemplateDescriptor)this.formArrayReadOnly.GetType()
                                                            .GetProperty(nameof(FormArrayReadOnlyObject <ObservableCollection <string>, string> .FormsCollectionDisplayTemplate))
                                                            .GetValue(this.formArrayReadOnly);

            Content = new AbsoluteLayout
            {
                HorizontalOptions = LayoutOptions.Fill,
                VerticalOptions   = LayoutOptions.Fill,
                Children          =
                {
                    new ContentView
                    {
                        Content = new StackLayout
                        {
                            Style    = LayoutHelpers.GetStaticStyleResource("FormArrayPopupViewStyle"),
                            Children =
                            {
                                new Grid
                                {
                                    Style    = LayoutHelpers.GetStaticStyleResource("PopupHeaderStyle"),
                                    Children =
                                    {
                                        new Label
                                        {
                                            Style = LayoutHelpers.GetStaticStyleResource("PopupHeaderLabelStyle"),
                                        }.AddBinding(Label.TextProperty, new Binding(nameof(FormArrayReadOnlyObject <ObservableCollection <string>, string> .Title)))
                                    }
                                },
                                new CollectionView
                                {
                                    Style        = LayoutHelpers.GetStaticStyleResource("FormArrayPopupCollectionViewStyle"),
                                    ItemTemplate = LayoutHelpers.GetCollectionViewItemTemplate
                                                   (
                                        this.formsCollectionDisplayTemplateDescriptor.TemplateName,
                                        this.formsCollectionDisplayTemplateDescriptor.Bindings
                                                   )
                                }
                                .AddBinding(ItemsView.ItemsSourceProperty, new Binding(nameof(FormArrayReadOnlyObject <ObservableCollection <string>, string> .Items)))
                                .AddBinding(SelectableItemsView.SelectionChangedCommandProperty, new Binding(nameof(FormArrayReadOnlyObject <ObservableCollection <string>, string> .SelectionChangedCommand)))
                                .AddBinding(SelectableItemsView.SelectedItemProperty, new Binding(nameof(FormArrayReadOnlyObject <ObservableCollection <string>, string> .SelectedItem))),
                                new BoxView                  {
                                    Style = LayoutHelpers.GetStaticStyleResource("PopupFooterSeparatorStyle")
                                },
                                new Grid
                                {
                                    Style             = LayoutHelpers.GetStaticStyleResource("PopupFooterStyle"),
                                    ColumnDefinitions =
                                    {
                                        new ColumnDefinition {
                                            Width = new GridLength(1, GridUnitType.Star)
                                        },
                                        new ColumnDefinition {
                                            Width = new GridLength(1, GridUnitType.Star)
                                        },
                                        new ColumnDefinition {
                                            Width = new GridLength(1, GridUnitType.Star)
                                        }
                                    },
                                    Children =
                                    {
                                        new Button
                                        {
                                            Style = LayoutHelpers.GetStaticStyleResource("PopupDetailButtonStyle")
                                        }
                                        .AddBinding(Button.CommandProperty, new Binding(nameof(FormArrayReadOnlyObject <ObservableCollection <string>, string> .DetailCommand)))
                                        .SetGridColumn(2),
                                        new Button
                                        {
                                            Style = LayoutHelpers.GetStaticStyleResource("PopupCancelButtonStyle")
                                        }
                                        .AddBinding(Button.CommandProperty, new Binding(nameof(FormArrayReadOnlyObject <ObservableCollection <string>, string> .CancelCommand)))
                                        .SetGridColumn(3)
                                    }
                                }
                            }
                        }
                    }
                    .AssignDynamicResource(VisualElement.BackgroundColorProperty, "PopupViewBackgroundColor")
                    .SetAbsoluteLayoutBounds(new Rectangle(0, 0, 1, 1))
                    .SetAbsoluteLayoutFlags(AbsoluteLayoutFlags.All)
                }
            };

            this.BackgroundColor = Color.Transparent;
            Visual = VisualMarker.Material;
            this.BindingContext = this.formArrayReadOnly;
        }
Exemplo n.º 3
0
        private void AddContent()
        {
            LayoutHelpers.AddToolBarItems(this.ToolbarItems, this.searchPageListViewModel.Buttons);
            Title = searchPageListViewModel.FormSettings.Title;

            Content = new Grid
            {
                Children =
                {
                    (
                        page                      = new StackLayout
                    {
                        Padding                   = new Thickness(30),
                        Children                  =
                        {
                            new Label
                            {
                                Style             = LayoutHelpers.GetStaticStyleResource("HeaderStyle")
                            }
                            .AddBinding(Label.TextProperty, new Binding(nameof(SearchPageCollectionViewModelBase.Title))),
                            new SearchBar
                            {
                                Behaviors         =
                                {
                                    new EventToCommandBehavior
                                    {
                                        EventName = nameof(SearchBar.TextChanged),
                                    }
                                    .AddBinding(EventToCommandBehavior.CommandProperty, new Binding(nameof(SearchPageCollectionViewModel <Domain.EntityModelBase> .TextChangedCommand)))
                                }
                            }
                            .AddBinding(SearchBar.TextProperty, new Binding(nameof(SearchPageCollectionViewModel <Domain.EntityModelBase> .SearchText)))
                            .AddBinding(SearchBar.PlaceholderProperty, new Binding(nameof(SearchPageCollectionViewModelBase.FilterPlaceholder))),
                            new RefreshView
                            {
                                Content           = new CollectionView
                                {
                                    Style         = LayoutHelpers.GetStaticStyleResource("SearchFormCollectionViewStyle"),
                                    ItemTemplate  = LayoutHelpers.GetCollectionViewItemTemplate
                                                    (
                                        this.searchPageListViewModel.FormSettings.ItemTemplateName,
                                        this.searchPageListViewModel.FormSettings.Bindings
                                                    )
                                }
                                .AddBinding(ItemsView.ItemsSourceProperty, new Binding(nameof(SearchPageCollectionViewModel <Domain.EntityModelBase> .Items)))
                                .AddBinding(SelectableItemsView.SelectionChangedCommandProperty, new Binding(nameof(SearchPageCollectionViewModel <Domain.EntityModelBase> .SelectionChangedCommand)))
                                .AddBinding(SelectableItemsView.SelectedItemProperty, new Binding(nameof(SearchPageCollectionViewModel <Domain.EntityModelBase> .SelectedItem)))
                            }
                            .AddBinding(RefreshView.IsRefreshingProperty, new Binding(nameof(SearchPageCollectionViewModel <Domain.EntityModelBase> .IsRefreshing)))
                            .AddBinding(RefreshView.CommandProperty, new Binding(nameof(SearchPageCollectionViewModel <Domain.EntityModelBase> .RefreshCommand)))
                        }
                    }
                    ),
                    (
                        transitionGrid            = new Grid().AssignDynamicResource
                                                    (
                            VisualElement.BackgroundColorProperty,
                            "PageBackgroundColor"
                                                    )
                    )
                }
            };
        }