예제 #1
0
        public ScrollableListView(ScrollableListViewModel <D, S, I> scrollableListViewModel) : base(ListViewCachingStrategy.RecycleElement)
        {
            this.scrollableListViewModel = scrollableListViewModel;

            ItemsSource   = scrollableListViewModel.Items;
            HasUnevenRows = true;

            ItemTemplate = Container.ServiceProvider.GetService(typeof(EntityTemplate <D>)) as EntityTemplate <D>;

            if (ItemTemplate is null)
            {
                Debug.WriteLine("Template Not Found : Using default for object");
                ItemTemplate = Container.ServiceProvider.GetService(typeof(EntityTemplate <object>)) as EntityTemplate <object>;
            }


            InfiniteScrollBehavior infiniteScrollBehavior = new InfiniteScrollBehavior();

            Behaviors.Add(infiniteScrollBehavior);

            Frame frame = new Frame()
            {
                BackgroundColor = Color.Transparent,
                BorderColor     = Color.Transparent,
                HasShadow       = false,
                Content         = new ActivityIndicator()
                {
                    IsRunning = true
                }
            };

            frame.SetBinding(IsVisibleProperty, new Binding(InfiniteScrollBehavior.IsLoadingMoreProperty.PropertyName, BindingMode.OneWay, source: infiniteScrollBehavior));

            Footer = frame;
        }
        public ProductListPage()
        {
            InitializeComponent();
            Title = "Products";

            model = new ScrollableListViewModel <productDTO, ProductSoapClient, ProductSoap>((service, quantity, offset) => {
                findCriteriaDTO findCriteriaDTO = new simpleCriteriaDTO()
                {
                    criteria = new productDTO()
                };

                findResultDTO findResultDTO = service.find(new[] { findCriteriaDTO }, quantity, offset);

                return(findResultDTO.results.Where(x => x is productDTO).Select(x => x as productDTO).ToList());
            });

            Content = new ScrollableListView <productDTO, ProductSoapClient, ProductSoap>(model);
        }