public ItemsSourceGenerator(ItemsView cv, int initialItems  = 1000,
                                    ItemsSourceType itemsSourceType = ItemsSourceType.List)
        {
            _cv = cv;
            _itemsSourceType = itemsSourceType;
            var layout = new StackLayout
            {
                Orientation       = StackOrientation.Horizontal,
                HorizontalOptions = LayoutOptions.Fill
            };

            var button = new Button {
                Text = "Update", AutomationId = "btnUpdate"
            };
            var label = new Label {
                Text = "Item count:", VerticalTextAlignment = TextAlignment.Center
            };

            _entry = new Entry {
                Keyboard = Keyboard.Numeric, Text = initialItems.ToString(), WidthRequest = 200, AutomationId = "entryUpdate"
            };

            layout.Children.Add(label);
            layout.Children.Add(_entry);
            layout.Children.Add(button);

            button.Clicked += GenerateItems;

            Content = layout;
        }
Example #2
0
        public ItemsSourceGenerator(ItemsView cv, int initialItems  = 1000,
                                    ItemsSourceType itemsSourceType = ItemsSourceType.List)
        {
            _count           = initialItems;
            _cv              = cv;
            _itemsSourceType = itemsSourceType;
            var layout = new StackLayout
            {
                Orientation       = StackOrientation.Horizontal,
                HorizontalOptions = LayoutOptions.Fill
            };

            var button = new Button {
                Text = "Update", AutomationId = "btnUpdate"
            };
            var label = new Label {
                Text = "Item count:", VerticalTextAlignment = TextAlignment.Center
            };

            _entry = new Entry {
                Keyboard = Keyboard.Numeric, Text = initialItems.ToString(), WidthRequest = 200, AutomationId = "entryUpdate"
            };

            layout.Children.Add(label);
            layout.Children.Add(_entry);
            layout.Children.Add(button);

            button.Clicked += GenerateItems;
            MessagingCenter.Subscribe <ExampleTemplateCarousel>(this, "remove", (obj) => {
                (cv.ItemsSource as ObservableCollection <CollectionViewGalleryTestItem>).Remove(obj.BindingContext as CollectionViewGalleryTestItem);
            });

            Content = layout;
        }
Example #3
0
        async void UpdateItemsSourceType(ItemsSourceGenerator generator, ItemsSourceType itemsSourceType, CollectionView collectionView)
        {
            generator.GenerateItems(itemsSourceType);

            if (Device.RuntimePlatform == Device.UWP && !(collectionView.ItemsSource is INotifyCollectionChanged))
            {
                await DisplayAlert("Warning!", "Reordering on UWP/WinUI only works with ObservableCollections!", "OK");
            }
        }
        private IList CreateItemsSource()
        {
            IList list = null;

            if (ItemsSourceType != null)
            {
                ConstructorInfo constructor = ItemsSourceType.GetConstructor(Type.EmptyTypes);
                list = ( IList )constructor.Invoke(null);
            }

            return(list);
        }
        private IEnumerable CreateItemsSource()
        {
            IEnumerable collection = null;

            if (ItemsSourceType != null)
            {
                var constructor = ItemsSourceType.GetConstructor(Type.EmptyTypes);
                if (constructor != null)
                {
                    collection = (IEnumerable)constructor.Invoke(null);
                }
            }

            return(collection);
        }
Example #6
0
        private IList CreateItemsSource()
        {
            IList list = null;

            if (ItemsSourceType != null && !ItemsSourceType.IsArray)
            {
                ConstructorInfo constructor = ItemsSourceType.GetConstructor(Type.EmptyTypes);
                list = (IList)constructor.Invoke(null);
            }
            else if (ItemsSourceType != null)
            {
                list = new ArrayList();
            }

            return(list);
        }
        private IEnumerable CreateItemsSource()
        {
            IEnumerable collection = null;

            if (ItemsSourceType != null)
            {
                var constructor = ItemsSourceType.GetConstructor(Type.EmptyTypes);
                if (constructor != null)
                {
                    collection = ( IEnumerable )constructor.Invoke(null);
                }
                else if (ItemsSourceType.IsArray)
                {
                    collection = Array.CreateInstance(ItemsSourceType.GetElementType(), Items.Count);
                }
            }

            return(collection);
        }
Example #8
0
        private void SetItemsSourceType(ItemsSourceType type)
        {
            if (!(BindingContext is SelectExpensePageViewModel viewModel))
            {
                return;
            }

            viewModel.IsReceipt = (type == ItemsSourceType.Receipt);

            switch (type)
            {
            case ItemsSourceType.Receipt:
                billSelectableFrame.Opacity    = 0.3;
                receiptSelectableFrame.Opacity = 1.0;
                break;

            case ItemsSourceType.Bill:
                receiptSelectableFrame.Opacity = 0.3;
                billSelectableFrame.Opacity    = 1.0;
                break;
            }
        }
Example #9
0
 public void GenerateItems(ItemsSourceType itemsSourceType)
 {
     _itemsSourceType = itemsSourceType;
     GenerateItems();
 }
Example #10
0
 public ItemsSourceReference(ItemsSourceType type, int id)
 {
     Type   = type;
     Filter = ItemsSourceFilter.Id;
     Param  = id.ToString();
 }
Example #11
0
 public ItemsSourceReference(ItemsSourceType type, ItemsSourceFilter filter)
 {
     Type   = type;
     Filter = filter;
 }