Esempio n. 1
0
        public override View Run()
        {
            var items = new List <string>();

            for (int i = 0; i < 1000; i++)
            {
                items.Add($"Items {i}");
            }

            var adaptor = new MyAdaptor2(items);

            var collectionView = new CollectionView();

            collectionView.Adaptor       = adaptor;
            collectionView.LayoutManager = new GridLayoutManager(false, 3);

            return(collectionView);
        }
        public override View Run()
        {
            var layout = new View
            {
                Layout = new LinearLayout
                {
                    LinearOrientation = LinearLayout.Orientation.Vertical,
                }
            };

            var hlayout = new View
            {
                Layout = new LinearLayout
                {
                    LinearOrientation = LinearLayout.Orientation.Horizontal
                },
                WidthResizePolicy = ResizePolicyType.FillToParent,
                SizeHeight        = 100,
            };

            layout.Add(hlayout);

            var more = new Button
            {
                Text = "More",
                HeightResizePolicy = ResizePolicyType.FillToParent,
                SizeWidth          = 200,
            };

            hlayout.Add(more);

            var less = new Button
            {
                Text = "Less",
                HeightResizePolicy = ResizePolicyType.FillToParent,
                SizeWidth          = 200,
            };

            hlayout.Add(less);

            var items = new List <string>();

            for (int i = 0; i < 1000; i++)
            {
                items.Add($"Items {i}");
            }

            var adaptor = new MyAdaptor2(items);

            var collectionView = new CollectionView();

            collectionView.Adaptor = adaptor;
            var layoutmanager = new GridLayoutManager(false, 3);

            collectionView.LayoutManager = layoutmanager;

            more.Clicked += (s, e) =>
            {
                layoutmanager.UpdateSpan(layoutmanager.Span + 1);
            };


            less.Clicked += (s, e) =>
            {
                layoutmanager.UpdateSpan(layoutmanager.Span - 1);
            };
            layout.Add(collectionView);

            return(layout);
        }