Exemple #1
0
        private static ItemsPresenter CreateTarget(
            Orientation orientation = Orientation.Vertical,
            bool useContainers      = true,
            int itemCount           = 20,
            bool useAvaloniaList    = false)
        {
            ItemsPresenter result;
            var            itemsSource = Enumerable.Range(0, itemCount).Select(x => $"Item {x}");
            var            items       = useAvaloniaList ?
                                         (IEnumerable) new AvaloniaList <string>(itemsSource) :
                                         (IEnumerable) new ObservableCollection <string>(itemsSource);

            var scroller = new TestScroller
            {
                CanHorizontallyScroll = true,
                CanVerticallyScroll   = true,
                Content = result = new TestItemsPresenter(useContainers)
                {
                    Items              = items,
                    ItemsPanel         = VirtualizingPanelTemplate(orientation),
                    ItemTemplate       = ItemTemplate(),
                    VirtualizationMode = ItemVirtualizationMode.Simple,
                }
            };

            scroller.UpdateChild();
            return(result);
        }
Exemple #2
0
        private static ItemsPresenter CreateTarget(
            ItemVirtualizationMode mode = ItemVirtualizationMode.Simple,
            Orientation orientation     = Orientation.Vertical,
            bool useContainers          = true,
            int itemCount = 20)
        {
            ItemsPresenter result;
            var            items = Enumerable.Range(0, itemCount).Select(x => $"Item {x}").ToList();

            var scroller = new TestScroller
            {
                CanHorizontallyScroll = false,
                CanVerticallyScroll   = true,
                Content = result = new TestItemsPresenter(useContainers)
                {
                    Items              = items,
                    ItemsPanel         = VirtualizingPanelTemplate(orientation),
                    ItemTemplate       = ItemTemplate(),
                    VirtualizationMode = mode,
                }
            };

            scroller.UpdateChild();

            return(result);
        }
        private static ItemsPresenter CreateTarget(
            Orientation orientation = Orientation.Vertical,
            bool useContainers = true,
            int itemCount = 20,
            bool useAvaloniaList = false)
        {
            ItemsPresenter result;
            var itemsSource = Enumerable.Range(0, itemCount).Select(x => $"Item {x}");
            var items = useAvaloniaList ?
                (IEnumerable)new AvaloniaList<string>(itemsSource) :
                (IEnumerable)new ObservableCollection<string>(itemsSource);

            var scroller = new TestScroller
            {
                Content = result = new TestItemsPresenter(useContainers)
                {
                    Items = items,
                    ItemsPanel = VirtualizingPanelTemplate(orientation),
                    ItemTemplate = ItemTemplate(),
                    VirtualizationMode = ItemVirtualizationMode.Simple,
                }
            };

            scroller.UpdateChild();

            return result;
        }
        private static ItemsPresenter CreateTarget(
            ItemVirtualizationMode mode = ItemVirtualizationMode.Simple,
            Orientation orientation = Orientation.Vertical,
            bool useContainers = true,
            int itemCount = 20)
        {
            ItemsPresenter result;
            var items = Enumerable.Range(0, itemCount).Select(x => $"Item {x}").ToList();

            var scroller = new TestScroller
            {
                Content = result = new TestItemsPresenter(useContainers)
                {
                    Items = items,
                    ItemsPanel = VirtualizingPanelTemplate(orientation),
                    ItemTemplate = ItemTemplate(),
                    VirtualizationMode = mode,
                }
            };

            scroller.UpdateChild();

            return result;
        }