public EditFormView(EditFormViewModel editFormViewModel) { this.editFormEntityViewModel = editFormViewModel.EditFormEntityViewModel; InitializeComponent(); LayoutHelpers.AddToolBarItems(this.ToolbarItems, this.editFormEntityViewModel.Buttons); Title = this.editFormEntityViewModel.FormSettings.Title; }
private void AddContent() { LayoutHelpers.AddToolBarItems(this.ToolbarItems, this.textPageScreenViewModel.Buttons); Title = this.textPageScreenViewModel.Title; Content = new Grid { Children = { new ScrollView { Content = GetScrollViewContent() }, GetTransitionGrid() } }; }
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" ) ) } }; }
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" ) ) } }; }
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" ) ) } }; }