Пример #1
0
        protected override void ModifyObservableCollection(MultiTestObservableCollection <CollectionViewGalleryTestItem> observableCollection, params int[] indexes)
        {
            if (indexes.Length < 2)
            {
                return;
            }

            var index1 = indexes[0];
            var index2 = indexes[1];

            if (index1 > -1 && index2 < observableCollection.Count && index1 <= index2)
            {
                var newItems = new List <CollectionViewGalleryTestItem>();

                for (int n = 0; n < 4; n++)
                {
                    newItems.Add(new CollectionViewGalleryTestItem(DateTime.Now.AddDays(n),
                                                                   $"Added", "coffee.png", n));
                }

                if (_withIndex)
                {
                    observableCollection.TestReplaceWithListAndIndex(index1, index2 - index1 + 1, newItems);
                }
                else
                {
                    observableCollection.TestReplaceWithList(index1, index2 - index1 + 1, newItems);
                }
            }
        }
Пример #2
0
        void GenerateMultiTestObservableCollection()
        {
            if (int.TryParse(_entry.Text, out int count))
            {
                var items = new MultiTestObservableCollection <CollectionViewGalleryTestItem>();

                for (int n = 0; n < count; n++)
                {
                    items.Add(new CollectionViewGalleryTestItem(DateTime.Now.AddDays(n),
                                                                $"{_images[n % _images.Length]}, {n}", _images[n % _images.Length], n));
                }

                _cv.ItemsSource = items;
            }
        }
Пример #3
0
        protected override void ModifyObservableCollection(MultiTestObservableCollection <CollectionViewGalleryTestItem> observableCollection, params int[] indexes)
        {
            var index1 = indexes[0];

            if (index1 > -1 && index1 < observableCollection.Count)
            {
                var newItems = new List <CollectionViewGalleryTestItem>();

                for (int n = 0; n < 4; n++)
                {
                    newItems.Add(new CollectionViewGalleryTestItem(DateTime.Now.AddDays(n),
                                                                   $"Added", "coffee.png", n));
                }

                if (_withIndex)
                {
                    observableCollection.TestAddWithListAndIndex(newItems, index1);
                }
                else
                {
                    observableCollection.TestAddWithList(newItems, index1);
                }
            }
        }