public MultipleTemplatesPage()
		{
			Title = "FlowListView Multiple templates Example";

			var flowListView = new FlowListView() {
				HorizontalOptions = LayoutOptions.FillAndExpand,
				VerticalOptions = LayoutOptions.FillAndExpand,
				SeparatorVisibility = SeparatorVisibility.None,

				FlowColumnsTemplates = new List<FlowColumnTemplateSelector>() {
					// First column definition:
					new FlowColumnSimpleTemplateSelector() { ViewType = typeof(FirstTemplate) }, 

					// Second column definition:
					new FlowColumnSimpleTemplateSelector() { ViewType = typeof(SecondTemplate) },

					// Third column definition:
					new FlowColumnSimpleTemplateSelector() { ViewType = typeof(ThirdTemplate) },
				},
			};

			// BINDINGS:

			// FlowListView FlowItemsSource:
			flowListView.SetBinding<MultipleTemplatesPageModel>(FlowListView.FlowItemsSourceProperty, v => v.Items);

			flowListView.SetBinding<MultipleTemplatesPageModel>(FlowListView.FlowLastTappedItemProperty, v => v.LastTappedItem);
			flowListView.SetBinding<MultipleTemplatesPageModel>(FlowListView.FlowItemTappedCommandProperty, v => v.ItemTappedCommand);

			Content = flowListView;
		}
Пример #2
0
        public WorkflowsPage()
        {
            NavigationPage.SetBackButtonTitle(this, "Back");
            Title          = "Workflows";
            ViewModel      = App.ViewModel;
            BindingContext = ViewModel;

            flowListView = new FlowListView
            {
                FlowColumnCount     = 2,
                VerticalOptions     = LayoutOptions.FillAndExpand,
                HorizontalOptions   = LayoutOptions.FillAndExpand,
                SeparatorVisibility = SeparatorVisibility.None,
                HasUnevenRows       = true,
                FlowColumnTemplate  = new DataTemplate(typeof(WorkflowViewCell))
            };

            flowListView.FlowTappedBackgroundColor = Color.LightGray;
            flowListView.SetBinding(FlowListView.FlowItemsSourceProperty, nameof(ViewModel.WorkflowListCollection));

            RootContent = flowListView;

            animationView.Loop     = true;
            animationView.AutoPlay = true;

            ViewModel.CurrentWorkflowSet += CurrentWorkflowSet;
        }
Пример #3
0
        public SelectionPage()
        {
            Title = "FlowListView Simple Example";

            var flowListView = new FlowListView()
            {
                HorizontalOptions   = LayoutOptions.FillAndExpand,
                VerticalOptions     = LayoutOptions.FillAndExpand,
                SeparatorVisibility = SeparatorVisibility.None,

                FlowTappedBackgroundColor = Color.Accent,
                FlowTappedBackgroundDelay = 250,

                FlowColumnsTemplates = new List <FlowColumnTemplateSelector>()
                {
                    // First column definition:
                    new FlowColumnSimpleTemplateSelector()
                    {
                        ViewType = typeof(SelectionExampleView)
                    },

                    // Second column definition:
                    new FlowColumnSimpleTemplateSelector()
                    {
                        ViewType = typeof(SelectionExampleView)
                    },

                    // Third column definition:
                    new FlowColumnSimpleTemplateSelector()
                    {
                        ViewType = typeof(SelectionExampleView)
                    },
                },
            };

            // BINDINGS:

            // FlowListView FlowItemsSource:
            flowListView.SetBinding <SelectionViewModel>(FlowListView.FlowItemsSourceProperty, v => v.Items);

            flowListView.SetBinding <SelectionViewModel>(FlowListView.FlowLastTappedItemProperty, v => v.LastTappedItem);
            flowListView.SetBinding <SelectionViewModel>(FlowListView.FlowItemTappedCommandProperty, v => v.ItemTappedCommand);

            Content = flowListView;
        }
Пример #4
0
        public GoalsView()
        {
            var goalList = new FlowListView(ListViewCachingStrategy.RecycleElement)
            {
                VerticalOptions     = LayoutOptions.Fill,
                SeparatorVisibility = SeparatorVisibility.None,
                BackgroundColor     = Color.Transparent,
                Margin             = new Thickness(5, 0),
                HasUnevenRows      = true,
                FlowColumnCount    = 1,
                FlowColumnTemplate = new DataTemplate(typeof(GoalViewCell)),
            };

            goalList.SetBinding(FlowListView.FlowItemsSourceProperty, nameof(GoalsViewModel.Goals));
            goalList.SetBinding(FlowListView.FlowLastTappedItemProperty, nameof(GoalsViewModel.SelectedGoal));
            goalList.SetBinding(FlowListView.FlowItemTappedCommandProperty, nameof(GoalsViewModel.ItemTappedCommand));

            Content = goalList;
        }
Пример #5
0
        public ApplicationsPage()
        {
            NavigationPage.SetBackButtonTitle(this, "Back");
            Title          = "Applications";
            ViewModel      = App.ViewModel;
            BindingContext = ViewModel;


            flowListView = new FlowListView
            {
                FlowColumnCount        = 2,
                VerticalOptions        = LayoutOptions.FillAndExpand,
                HorizontalOptions      = LayoutOptions.FillAndExpand,
                SeparatorVisibility    = SeparatorVisibility.None,
                HasUnevenRows          = Device.RuntimePlatform.Equals(Device.iOS),
                IsPullToRefreshEnabled = true,
                FlowColumnTemplate     = new DataTemplate(typeof(ApplicationViewCell))
            };
            if (Device.RuntimePlatform.Equals(Device.Android))
            {
                flowListView.RowHeight = (int)(App.ScreenHeight / 2.5);
            }

            flowListView.FlowTappedBackgroundColor = Color.LightGray;
            flowListView.SetBinding(FlowListView.FlowItemsSourceProperty, nameof(ViewModel.ApplicationListCollection));
            flowListView.SetBinding(FlowListView.RefreshCommandProperty, nameof(ViewModel.FlowListViewRefreshCommand));
            flowListView.SetBinding(FlowListView.IsRefreshingProperty, nameof(ViewModel.IsBusy));


            RootContent = flowListView;


            animationView.Loop     = true;
            animationView.AutoPlay = true;
            animationView.Scale    = 0.5;

            ViewModel.RetreievedAllWorkflows += RetreievedAllWorkflows;
        }
		public FlowListViewGroupingPage()
		{
			Title = "FlowListView Grouping Example";

			var flowListView = new FlowListView() {
				HorizontalOptions = LayoutOptions.FillAndExpand,
				VerticalOptions = LayoutOptions.FillAndExpand,
				SeparatorVisibility = SeparatorVisibility.None,

				FlowColumnsTemplates = new List<FlowColumnTemplateSelector>() {
					new FlowColumnSimpleTemplateSelector() { ViewType = typeof(FlowGroupingExampleViewCell) },
					new FlowColumnSimpleTemplateSelector() { ViewType = typeof(FlowGroupingExampleViewCell) },
					new CustomTemplateSelector(), // custom selector basing on bindingContext
				},
					
				IsGroupingEnabled = true,
				FlowGroupKeySorting = FlowSorting.Ascending,
				FlowGroupItemSorting = FlowSorting.Ascending,
				FlowGroupGroupingKeySelector = new CustomGroupKeySelector(),
				FlowGroupItemSortingKeySelector = new CustomItemSortingKeySelector(),
			};

			flowListView.SetBinding<FlowListViewGroupingViewModel>(FlowListView.FlowItemsSourceProperty, v => v.Items);

			flowListView.FlowItemTapped += (sender, e) => {
				var item = e.Item as FlowItem;
				if (item != null)
					System.Diagnostics.Debug.WriteLine("FlowListView tapped: {0}", item.Title);
			};

			var button1 = new Button() {
				Text = "Remove few first collection items",
				Command = ViewModel.ModifyCollectionCommand
			};

			var button2 = new Button() {
				Text = "Modify collection items",
				Command = ViewModel.ModifyCollectionItemsCommand
			};

			Content = new StackLayout() {
				HorizontalOptions = LayoutOptions.FillAndExpand,
				VerticalOptions = LayoutOptions.FillAndExpand,
				Children = {
					flowListView,
					button1,
					button2,
				}
			};
		}
        private void LoadUI()
        {
            var dataTemplate = new DataTemplate(() =>
            {
                var image = new Image();
                image.SetBinding(Image.SourceProperty, "BgImage");

                var titleLabel = new Label
                {
                    FontSize  = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
                    TextColor = Color.White,
                };
                titleLabel.SetBinding(Label.TextProperty, "Title");

                var subTitleLabel = new Label
                {
                    FontSize  = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
                    TextColor = Color.White,
                };
                subTitleLabel.SetBinding(Label.TextProperty, "Subtitle");

                return(new StackLayout
                {
                    BackgroundColor = Color.Pink,
                    Padding = 2,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    Children =
                    {
                        new Frame                   {
                            Content = new AbsoluteLayout{
                                HorizontalOptions = LayoutOptions.FillAndExpand,
                                VerticalOptions = LayoutOptions.FillAndExpand,
                                Children =
                                {
                                    image,
                                    new StackLayout {
                                        Margin = new Thickness(20),
                                        VerticalOptions = LayoutOptions.CenterAndExpand,
                                        HorizontalOptions = LayoutOptions.CenterAndExpand,
                                        Children =
                                        {
                                            titleLabel,
                                            subTitleLabel
                                        }
                                    }
                                }
                            }
                        }
                    }
                });
            });

            var flowList = new FlowListView();

            flowList.SetBinding(FlowListView.FlowItemsSourceProperty, "List");
            flowList.FlowColumnTemplate = dataTemplate;
            flowList.BackgroundColor    = Color.LightGoldenrodYellow;
            flowList.FlowColumnCount    = 1;
            flowList.HasUnevenRows      = true;

            var button = new Button {
                Text = "Add"
            };

            button.Clicked += Button_Clicked
            ;
            Content = new StackLayout
            {
                Children =
                {
                    button,
                    flowList
                }
            };
        }