Ejemplo 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"
                                               )
                    )
                }
            };
        }
Ejemplo n.º 2
0
        public ChildFormPageCS(IValidatable formValidatable)
        {
            this.formValidatable = formValidatable;
            this.formLayout      = (EditFormLayout)this.formValidatable.GetType()
                                   .GetProperty(nameof(FormValidatableObject <string> .FormLayout))
                                   .GetValue(this.formValidatable);

            Content = new AbsoluteLayout
            {
                HorizontalOptions = LayoutOptions.Fill,
                VerticalOptions   = LayoutOptions.Fill,
                Children          =
                {
                    new ContentView
                    {
                        Content = new StackLayout
                        {
                            Style    = LayoutHelpers.GetStaticStyleResource("ChildFormPopupViewStyle"),
                            Children =
                            {
                                new Grid
                                {
                                    Style    = LayoutHelpers.GetStaticStyleResource("PopupHeaderStyle"),
                                    Children =
                                    {
                                        new Label
                                        {
                                            Style = LayoutHelpers.GetStaticStyleResource("PopupHeaderLabelStyle"),
                                        }.AddBinding(Label.TextProperty, new Binding("Title"))
                                    }
                                },
                                new ScrollView
                                {
                                    Style   = LayoutHelpers.GetStaticStyleResource("ChildFormPopupScrollViewStyle"),
                                    Content = this.formLayout.ControlGroupBoxList.Aggregate
                                              (
                                        new StackLayout(),
                                        (stackLayout, controlBox) =>
                                    {
                                        if (controlBox.IsVisible == false)
                                        {
                                            return(stackLayout);
                                        }

                                        stackLayout.Children.Add
                                        (
                                            new Label
                                        {
                                            Style          = LayoutHelpers.GetStaticStyleResource("EditFormGroupHeaderStyle"),
                                            BindingContext = controlBox
                                        }
                                            .AddBinding
                                            (
                                                Label.TextProperty,
                                                GetHeaderBinding(controlBox.HeaderBindings, $"{nameof(ControlGroupBox.GroupHeader)}")
                                            )
                                        );
                                        stackLayout.Children.Add
                                        (
                                            new StackLayout
                                        {
                                            VerticalOptions = LayoutOptions.StartAndExpand,
                                            BindingContext  = controlBox
                                        }
                                            .AddBinding(BindableLayout.ItemsSourceProperty, new Binding("."))
                                            .SetDataTemplateSelector(EditFormViewHelpers.QuestionTemplateSelector)
                                        );

                                        return(stackLayout);
                                    }
                                              )
                                },
                                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("PopupCancelButtonStyle")
                                        }
                                        .AddBinding(Button.CommandProperty, new Binding("CancelCommand"))
                                        .SetGridColumn(1),
                                        new Button
                                        {
                                            Style = LayoutHelpers.GetStaticStyleResource("PopupAcceptButtonStyle")
                                        }
                                        .AddBinding(Button.CommandProperty, new Binding("SubmitCommand"))
                                        .SetGridColumn(2)
                                    }
                                }
                            }
                        }
                    }
                    .AssignDynamicResource(VisualElement.BackgroundColorProperty, "PopupViewBackgroundColor")
                    .SetAbsoluteLayoutBounds(new Rectangle(0, 0, 1, 1))
                    .SetAbsoluteLayoutFlags(AbsoluteLayoutFlags.All)
                }
            };

            this.BackgroundColor = Color.Transparent;
            Visual = VisualMarker.Material;
            this.BindingContext = this.formValidatable;

            BindingBase GetHeaderBinding(MultiBindingDescriptor multiBindingDescriptor, string bindingName)
            {
                if (multiBindingDescriptor == null)
                {
                    return(new Binding(bindingName));
                }

                return(new MultiBinding
                {
                    StringFormat = multiBindingDescriptor.StringFormat,
                    Bindings = multiBindingDescriptor.Fields.Select
                               (
                        field => new Binding($"{nameof(ControlGroupBox.BindingPropertiesDictionary)}[{field.ToBindingDictionaryKey()}].{nameof(IValidatable.Value)}")
                               )
                               .Cast <BindingBase>()
                               .ToList()
                });
            }
        }
Ejemplo n.º 3
0
        public ReadOnlyMultiSelectPageCS(IReadOnly multiSelectReadOnly)
        {
            this.multiSelectReadOnly           = multiSelectReadOnly;
            this.multiSelectTemplateDescriptor = (MultiSelectTemplateDescriptor)this.multiSelectReadOnly.GetType()
                                                 .GetProperty(nameof(MultiSelectReadOnlyObject <ObservableCollection <string>, string> .MultiSelectTemplate))
                                                 .GetValue(this.multiSelectReadOnly);

            Content = new AbsoluteLayout
            {
                HorizontalOptions = LayoutOptions.Fill,
                VerticalOptions   = LayoutOptions.Fill,
                Children          =
                {
                    new ContentView
                    {
                        Content = new StackLayout
                        {
                            Style    = LayoutHelpers.GetStaticStyleResource("MultiSelectPopupViewStyle"),
                            Children =
                            {
                                new Grid
                                {
                                    Style    = LayoutHelpers.GetStaticStyleResource("PopupHeaderStyle"),
                                    Children =
                                    {
                                        new Label
                                        {
                                            Style = LayoutHelpers.GetStaticStyleResource("PopupHeaderLabelStyle"),
                                        }.AddBinding(Label.TextProperty, new Binding("Title"))
                                    }
                                },
                                new Grid
                                {
                                    Children =
                                    {
                                        new CollectionView
                                        {
                                            Style        = LayoutHelpers.GetStaticStyleResource("MultiSelectPopupCollectionViewStyle"),
                                            ItemTemplate = EditFormViewHelpers.GetMultiSelectItemTemplateSelector(this.multiSelectTemplateDescriptor)
                                        }
                                        .AddBinding(ItemsView.ItemsSourceProperty, new Binding("Items"))
                                        .AddBinding(SelectableItemsView.SelectedItemsProperty, new Binding("SelectedItems")),
                                        new BoxView()
                                    }
                                },
                                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("PopupCancelButtonStyle")
                                        }
                                        .AddBinding(Button.CommandProperty, new Binding("CancelCommand"))
                                        .SetGridColumn(2)
                                    }
                                }
                            }
                        }
                    }
                    .AssignDynamicResource(VisualElement.BackgroundColorProperty, "PopupViewBackgroundColor")
                    .SetAbsoluteLayoutBounds(new Rectangle(0, 0, 1, 1))
                    .SetAbsoluteLayoutFlags(AbsoluteLayoutFlags.All)
                }
            };

            this.BackgroundColor = Color.Transparent;
            Visual = VisualMarker.Material;
            this.BindingContext = this.multiSelectReadOnly;
        }
        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;
        }
Ejemplo n.º 5
0
        private void AddContent()
        {
            LayoutHelpers.AddToolBarItems(this.ToolbarItems, this.editFormEntityViewModel.Buttons);
            Title = editFormEntityViewModel.FormSettings.Title;

            BindingBase GetHeaderBinding(MultiBindingDescriptor multiBindingDescriptor, string bindingName)
            {
                if (multiBindingDescriptor == null)
                {
                    return(new Binding(bindingName));
                }

                return(new MultiBinding
                {
                    StringFormat = multiBindingDescriptor.StringFormat,
                    Bindings = multiBindingDescriptor.Fields.Select
                               (
                        field => new Binding($"{nameof(ControlGroupBox.BindingPropertiesDictionary)}[{field.ToBindingDictionaryKey()}].{nameof(IValidatable.Value)}")
                               )
                               .Cast <BindingBase>()
                               .ToList()
                });
            }

            Content = new Grid
            {
                Children =
                {
                    (
                        page                            = new StackLayout
                    {
                        Padding                         = new Thickness(30),
                        Children                        =
                        {
                            new Label
                            {
                                Style                   = LayoutHelpers.GetStaticStyleResource("HeaderStyle")
                            }
                            .AddBinding
                            (
                                Label.TextProperty,
                                GetHeaderBinding
                                (
                                    editFormEntityViewModel.FormSettings.HeaderBindings,
                                    $"{nameof(EditFormEntityViewModelBase.FormSettings)}.{nameof(DataFormSettingsDescriptor.Title)}"
                                )
                            ),
                            new ScrollView
                            {
                                Content                 = editFormEntityViewModel.FormLayout.ControlGroupBoxList.Aggregate
                                                          (
                                    new StackLayout(),
                                    (stackLayout, controlBox) =>
                                {
                                    if (controlBox.IsVisible == false)
                                    {
                                        return(stackLayout);
                                    }

                                    stackLayout.Children.Add
                                    (
                                        new Label
                                    {
                                        Style           = LayoutHelpers.GetStaticStyleResource("EditFormGroupHeaderStyle"),
                                        BindingContext  = controlBox
                                    }
                                        .AddBinding
                                        (
                                            Label.TextProperty,
                                            GetHeaderBinding(controlBox.HeaderBindings, $"{nameof(ControlGroupBox.GroupHeader)}")
                                        )
                                    );
                                    stackLayout.Children.Add
                                    (
                                        new StackLayout
                                    {
                                        VerticalOptions = LayoutOptions.StartAndExpand,
                                        BindingContext  = controlBox
                                    }
                                        .AddBinding(BindableLayout.ItemsSourceProperty, new Binding("."))
                                        .SetDataTemplateSelector(EditFormViewHelpers.QuestionTemplateSelector)
                                    );

                                    return(stackLayout);
                                }
                                                          )
                            }
                        }
                    }
                    ),
                    (
                        transitionGrid                  = new Grid().AssignDynamicResource
                                                          (
                            VisualElement.BackgroundColorProperty,
                            "PageBackgroundColor"
                                                          )
                    )
                }
            };
        }
Ejemplo n.º 6
0
        private void AddContent()
        {
            AddToolBarItems();

            Title   = editFormEntityViewModel.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("FormSettings.Title")),
                            new CollectionView
                            {
                                SelectionMode = SelectionMode.Single,
                                ItemTemplate  = EditFormViewHelpers.QuestionTemplateSelector
                            }
                            .AddBinding(ItemsView.ItemsSourceProperty, new Binding("Properties")),
                        }
                    }
                    ),
                    (
                        transitionGrid        = new Grid().AssignDynamicResource
                                                (
                            VisualElement.BackgroundColorProperty,
                            "PageBackgroundColor"
                                                )
                    )
                }
            };

            void AddToolBarItems()
            {
                foreach (var button in editFormEntityViewModel.Buttons)
                {
                    this.ToolbarItems.Add(BuildToolbarItem(button));
                }
            }

            ToolbarItem BuildToolbarItem(CommandButtonDescriptor button)
            => new ToolbarItem
            {
                AutomationId = button.ShortString,
                Text         = button.LongString,
                //IconImageSource = new FontImageSource
                //{
                //    FontFamily = EditFormViewHelpers.GetFontAwesomeFontFamily(),
                //    Glyph = FontAwesomeIcons.Solid[button.ButtonIcon],
                //    Size = 20
                //},
                Order            = ToolbarItemOrder.Primary,
                Priority         = 0,
                CommandParameter = button
            }

            .AddBinding(MenuItem.CommandProperty, new Binding(button.Command))
            .SetAutomationPropertiesName(button.ShortString);
        }
Ejemplo n.º 7
0
        private View GetScrollViewContent()
        {
            page = new StackLayout
            {
                Padding  = new Thickness(30),
                Children =
                {
                    new Label
                    {
                        Text  = this.textPageScreenViewModel.Title,
                        Style = LayoutHelpers.GetStaticStyleResource("HeaderStyle")
                    }
                }
            };

            foreach (var group in textPageScreenViewModel.FormSettings.TextGroups)
            {
                page.Children.Add(GetGroupHeader(group));
                foreach (LabelItemDescriptorBase item in group.Labels)
                {
                    switch (item)
                    {
                    case LabelItemDescriptor labelItemDescriptor:
                        page.Children.Add(GetLabelItem(labelItemDescriptor));
                        break;

                    case HyperLinkLabelItemDescriptor hyperLinkLabelItemDescriptor:
                        page.Children.Add(GetHyperLinkLabelItem(hyperLinkLabelItemDescriptor));
                        break;

                    case FormattedLabelItemDescriptor formattedItemDescriptor:
                        page.Children.Add(GetFornattedLabelItem(formattedItemDescriptor));
                        break;

                    default:
                        throw new ArgumentException($"{nameof(item)}: 615C881A-3EA5-4681-AD72-482E055E728E");
                    }
                }
            }

            return(page);

            Label GetFornattedLabelItem(FormattedLabelItemDescriptor formattedItemDescriptor)
            {
                Label formattedLabel = new Label
                {
                    FormattedText = new FormattedString
                    {
                        Spans = { }
                    }
                };

                foreach (SpanItemDescriptorBase item in formattedItemDescriptor.Items)
                {
                    switch (item)
                    {
                    case SpanItemDescriptor spanItemDescriptor:
                        formattedLabel.FormattedText.Spans.Add(GetSpanItem(spanItemDescriptor));
                        break;

                    case HyperLinkSpanItemDescriptor hyperLinkSpanItemDescriptor:
                        formattedLabel.FormattedText.Spans.Add(GetHyperLinkSpanItem(hyperLinkSpanItemDescriptor));
                        break;

                    default:
                        throw new ArgumentException($"{nameof(item)}: BD90BDA3-31E9-4FCC-999E-2486CB527E30");
                    }
                }

                return(formattedLabel);
            }

            Span GetHyperLinkSpanItem(HyperLinkSpanItemDescriptor spanItemDescriptor)
            => new Span
            {
                Text  = spanItemDescriptor.Text,
                Style = LayoutHelpers.GetStaticStyleResource("TextFormHyperLinkSpanStyle"),
                GestureRecognizers =
                {
                    new TapGestureRecognizer
                    {
                        CommandParameter = spanItemDescriptor.Url
                    }
                    .AddBinding(TapGestureRecognizer.CommandProperty, new Binding(path: "TapCommand"))
                }
            };

            Span GetSpanItem(SpanItemDescriptor spanItemDescriptor)
            => new Span
            {
                Text  = spanItemDescriptor.Text,
                Style = LayoutHelpers.GetStaticStyleResource("TextFormItemSpanStyle")
            };


            Label GetHyperLinkLabelItem(HyperLinkLabelItemDescriptor labelItemDescriptor)
            => new Label
            {
                Text  = labelItemDescriptor.Text,
                Style = LayoutHelpers.GetStaticStyleResource("TextFormHyperLinkLabelStyle"),
                GestureRecognizers =
                {
                    new TapGestureRecognizer
                    {
                        CommandParameter = labelItemDescriptor.Url
                    }
                    .AddBinding(TapGestureRecognizer.CommandProperty, new Binding(path: "TapCommand"))
                }
            };

            Label GetLabelItem(LabelItemDescriptor labelItemDescriptor)
            => new Label
            {
                Text  = labelItemDescriptor.Text,
                Style = LayoutHelpers.GetStaticStyleResource("TextFormItemLabelStyle")
            };

            Label GetGroupHeader(TextGroupDescriptor textGroupDescriptor)
            => new Label
            {
                Text  = textGroupDescriptor.Title,
                Style = LayoutHelpers.GetStaticStyleResource("TextFormGroupHeaderStyle")
            };
        }
Ejemplo n.º 8
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"
                                                    )
                    )
                }
            };
        }
Ejemplo n.º 9
0
        public ChildFormPageCS(IValidatable formValidatable)
        {
            this.formValidatable             = formValidatable;
            this.formGroupSettingsDescriptor = (FormGroupSettingsDescriptor)this.formValidatable.GetType()
                                               .GetProperty(nameof(FormValidatableObject <object> .FormSettings))
                                               .GetValue(this.formValidatable);

            Content = new AbsoluteLayout
            {
                HorizontalOptions = LayoutOptions.Fill,
                VerticalOptions   = LayoutOptions.Fill,
                Children          =
                {
                    new ContentView
                    {
                        Content = new StackLayout
                        {
                            Style    = LayoutHelpers.GetStaticStyleResource("ChildFormPopupViewStyle"),
                            Children =
                            {
                                new Grid
                                {
                                    Style    = LayoutHelpers.GetStaticStyleResource("PopupHeaderStyle"),
                                    Children =
                                    {
                                        new Label
                                        {
                                            Style = LayoutHelpers.GetStaticStyleResource("PopupHeaderLabelStyle"),
                                        }.AddBinding(Label.TextProperty, new Binding("Title"))
                                    }
                                },
                                new CollectionView
                                {
                                    Style        = LayoutHelpers.GetStaticStyleResource("ChildFormPopupCollectionViewStyle"),
                                    ItemTemplate = EditFormViewHelpers.QuestionTemplateSelector
                                }
                                .AddBinding(ItemsView.ItemsSourceProperty, new Binding("Properties")),
                                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("PopupCancelButtonStyle")
                                        }
                                        .AddBinding(Button.CommandProperty, new Binding("CancelCommand"))
                                        .SetGridColumn(1),
                                        new Button
                                        {
                                            Style = LayoutHelpers.GetStaticStyleResource("PopupAcceptButtonStyle")
                                        }
                                        .AddBinding(Button.CommandProperty, new Binding("SubmitCommand"))
                                        .SetGridColumn(2)
                                    }
                                }
                            }
                        }
                    }
                    .AssignDynamicResource(VisualElement.BackgroundColorProperty, "PopupViewBackgroundColor")
                    .SetAbsoluteLayoutBounds(new Rectangle(0, 0, 1, 1))
                    .SetAbsoluteLayoutFlags(AbsoluteLayoutFlags.All)
                }
            };

            this.BackgroundColor = Color.Transparent;
            this.BindingContext  = this.formValidatable;
        }