Пример #1
0
        public PickerCellTestViewModel()
        {
            for (var i = 0; i < 30; i++)
            {
                ItemsSource.Add(new Person()
                {
                    Name = $"Name{i}",
                    Age  = 30 - i
                });
                ItemsSource2.Add(i);
            }

            DisplayMember.Value  = "Name";
            DisplayMember2.Value = "";

            OwnAccentColor.Value        = AccentColor;
            PageTitle.Value             = PageTitles[0];
            MaxSelectedNumber.Value     = MaxSelectedNumbers[0];
            KeepSelected.Value          = bools[0];
            SelectedItemsOrderKey.Value = DisplayMembers[0];
            ChangeSelectedItems();

            SelectedCommand.Subscribe(obj => {
                var list = obj as ObservableCollection <Person>;
                System.Diagnostics.Debug.WriteLine(list);
            });
        }
 public PaginatingItemsControl()
 {
     NextPageCommand = new PageCommand(() =>
     {
         if ((_index + 1) * ItemsPerPage >= ItemsSource2.Cast <object>().Count())
         {
             return;
         }
         _index++;
         ItemsSource = ItemsSource2.Cast <object>().Skip(_index * ItemsPerPage).Take(ItemsPerPage);
         HasNext     = (_index + 1) * ItemsPerPage < ItemsSource2.Cast <object>().Count();
         HasPrevious = _index > 0;
     });
     PreviousPageCommand = new PageCommand(() =>
     {
         if (_index == 0)
         {
             return;
         }
         _index--;
         ItemsSource = ItemsSource2.Cast <object>().Skip(_index * ItemsPerPage).Take(ItemsPerPage);
         HasNext     = (_index + 1) * ItemsPerPage < ItemsSource2.Cast <object>().Count();
         HasPrevious = _index > 0;
     });
 }
Пример #3
0
        private void ItemsSource2Changed()
        {
            int maxValue = Math.Max(ItemsSource1?.Max(elem => elem.Score) ?? 0, ItemsSource2?.Max(elem => elem.Score) ?? 0);

            _secondaryAxis.Maximum = maxValue;

            _splineSeries2.ItemsSource = ItemsSource2;
            _splineSeries2.EnableDataPointSelection = true;
            _splineSeries2.Color = Chart2Color;
            _splineSeries2.SelectedDataPointColor = ChartSelectedColor;
        }
Пример #4
0
        protected override void CellChanged(object obj)
        {
            base.CellChanged(obj);

            var text = (obj as Label).Text;

            switch (text)
            {
            case nameof(OwnAccentColor):
                NextVal(OwnAccentColor, AccentColors);
                break;

            case nameof(PageTitle):
                NextVal(PageTitle, PageTitles);
                break;

            case nameof(DisplayMember):
                NextVal(DisplayMember, DisplayMembers);
                NextVal(SubDisplayMember, DisplayMembers);
                break;

            case nameof(MaxSelectedNumber):
                NextVal(MaxSelectedNumber, MaxSelectedNumbers);
                break;

            case nameof(KeepSelected):
                NextVal(KeepSelected, bools);
                break;

            case nameof(SelectedItems):
                ChangeSelectedItems();
                break;

            case nameof(SelectedItemsOrderKey):
                NextVal(SelectedItemsOrderKey, DisplayMembers);
                break;

            case nameof(UseNaturalSort):
                NextVal(UseNaturalSort, bools);
                break;

            case nameof(UseAutoValueText):
                NextVal(UseAutoValueText, bools);
                break;

            case nameof(UsePickToClose):
                NextVal(UsePickToClose, bools);
                break;

            case "AddItem":
                ItemsSource2.Add(new Random().Next(1, 30));
                break;

            case "RemoveItem":
                if (ItemsSource2.Count > 0)
                {
                    ItemsSource2.RemoveAt(0);
                }
                break;

            case nameof(IsVisible):
                NextVal(IsVisible, bools);
                break;
            }
        }
Пример #5
0
        public HCollectionViewTestViewModel(IPageDialogService pageDialog)
        {
            _pageDlg   = pageDialog;
            TestSource = new TestFormViewModel
            {
                ItemsSource = TestList,
                PageDialog  = pageDialog
            };

            InitializeProperties();

            TestList.Add("Test Start").Add(
                "Manipulation Test1. Has SectionB - Title11 been scrolled to Top to Bottom to Center?",
                async() => {
                ScrollController.ScrollToStart();
                await Task.Delay(2000);
                ScrollController.ScrollTo(ItemsSource[1][0], ItemsSource[1], ScrollToPosition.Start, false);
                await Task.Delay(2000);
                ScrollController.ScrollTo(ItemsSource[1][0], ItemsSource[1], ScrollToPosition.End, false);
                await Task.Delay(2000);
                ScrollController.ScrollTo(ItemsSource[1][0], ItemsSource[1], ScrollToPosition.Center, false);
            }
                ).Add(
                "Manipulation Test2. Has SectionB - Title11 been scrolled to Top to Bottom to Center with animation?",
                async() => {
                ScrollController.ScrollToStart(true);
                await Task.Delay(2000);
                ScrollController.ScrollTo(ItemsSource[1][0], ItemsSource[1], ScrollToPosition.Start, true);
                await Task.Delay(2000);
                ScrollController.ScrollTo(ItemsSource[1][0], ItemsSource[1], ScrollToPosition.End, true);
                await Task.Delay(2000);
                ScrollController.ScrollTo(ItemsSource[1][0], ItemsSource[1], ScrollToPosition.Center, true);
            }
                ).Add(
                "Manipulation Test3. Has SectionC - Title7 been scrolled to Top to Bottom to Center with animation?",
                async() => {
                ScrollController.ScrollToStart(true);
                await Task.Delay(2000);
                ScrollController.ScrollTo(ItemsSource[2][1], ItemsSource[2], ScrollToPosition.Start, true);
                await Task.Delay(2000);
                ScrollController.ScrollTo(ItemsSource[2][1], ItemsSource[2], ScrollToPosition.End, true);
                await Task.Delay(2000);
                ScrollController.ScrollTo(ItemsSource[2][1], ItemsSource[2], ScrollToPosition.Center, true);
            }
                ).Add(
                "Manipulation Test4. Has Title5 been scrolled to Top to Bottom to Center?",
                async() => {
                ScrollController2.ScrollToStart();
                await Task.Delay(2000);
                ScrollController2.ScrollTo(ItemsSource2[4], ScrollToPosition.Start, false);
                await Task.Delay(2000);
                ScrollController2.ScrollTo(ItemsSource2[4], ScrollToPosition.End, false);
                await Task.Delay(2000);
                ScrollController2.ScrollTo(ItemsSource2[4], ScrollToPosition.Center, false);
            }
                ).Add(
                "Manipulation Test5. Has Title5 been scrolled to Top to Bottom to Center with animation?",
                async() => {
                ScrollController2.ScrollToStart(true);
                await Task.Delay(2000);
                ScrollController2.ScrollTo(ItemsSource2[4], ScrollToPosition.Start, true);
                await Task.Delay(2000);
                ScrollController2.ScrollTo(ItemsSource2[4], ScrollToPosition.End, true);
                await Task.Delay(2000);
                ScrollController2.ScrollTo(ItemsSource2[4], ScrollToPosition.Center, true);
            }
                ).Add(
                "Manipulation Test6. Has new cell been inserted before Title1?",
                async() =>
            {
                ScrollController.ScrollToStart(true);
                ScrollController2.ScrollToStart(true);
                await Task.Delay(2000);
                ItemsSource[0].Insert(0, GetAdditionalItem());
                ItemsSource2.Insert(0, GetAdditionalItem());
            }
                ).Add(
                "Manipulation Test7. Has new cell been inserted after Title20?",
                async() =>
            {
                ScrollController.ScrollTo(ItemsSource[0][20], ItemsSource[0], ScrollToPosition.Center, true);
                ScrollController2.ScrollToEnd(true);
                await Task.Delay(2000);
                ItemsSource[0].Add(GetAdditionalItem());
                ItemsSource2.Add(GetAdditionalItem());
            }
                ).Add(
                "Manipulation Test8. Has new cell been inserted between Title8 and Title9?",
                async() =>
            {
                ScrollController.ScrollTo(ItemsSource[0][8], ItemsSource[0], ScrollToPosition.Center, true);
                ScrollController2.ScrollTo(ItemsSource2[8], ScrollToPosition.Center, true);
                await Task.Delay(2000);
                ItemsSource[0].Insert(9, GetAdditionalItem());
                ItemsSource2.Insert(9, GetAdditionalItem());
            }
                ).Add(
                "Manipulation Test9. Has the first cell been deleted?",
                async() =>
            {
                ScrollController.ScrollToStart(true);
                ScrollController2.ScrollToStart(true);
                await Task.Delay(2000);
                ItemsSource[0].RemoveAt(0);
                ItemsSource2.RemoveAt(0);
            }
                ).Add(
                "Manipulation Test10. Has the last cell in SectionA been deleted?",
                async() =>
            {
                ScrollController.ScrollTo(ItemsSource[0][21], ItemsSource[0], ScrollToPosition.End, true);
                ScrollController2.ScrollToEnd();
                await Task.Delay(2000);
                ItemsSource[0].RemoveAt(ItemsSource[0].Count - 1);
                ItemsSource2.RemoveAt(ItemsSource2.Count - 1);
            }
                ).Add(
                "Manipulation Test11. Has the cell between Title8 and Title9 in SectionA been deleted?",
                async() =>
            {
                ScrollController.ScrollTo(ItemsSource[0][8], ItemsSource[0], ScrollToPosition.Center, true);
                ScrollController2.ScrollTo(ItemsSource2[8], ScrollToPosition.Center, true);
                await Task.Delay(2000);
                ItemsSource[0].RemoveAt(8);
                ItemsSource2.RemoveAt(8);
            }
                ).Add(
                "Manipulation Test12. Has the first cell been changed to AddItem?",
                async() =>
            {
                ScrollController.ScrollToStart(true);
                ScrollController2.ScrollToStart(true);
                await Task.Delay(2000);
                ItemsSource[0][0] = GetAdditionalItem();
                ItemsSource2[0]   = GetAdditionalItem();
            }
                ).Add(
                "Manipulation Test13. Has the first cell been moved to after Title5?",
                async() =>
            {
                ScrollController.ScrollToStart(true);
                ScrollController2.ScrollToStart(true);
                await Task.Delay(2000);
                ItemsSource[0].Move(0, 4);
                ItemsSource2.Move(0, 4);
            }
                ).Add(
                "Manipulation Test14. Has new section been inserted at last?",
                async() =>
            {
                await Task.Delay(2000);
                ItemsSource.Add(_additionalGroup);
                await Task.Delay(2000);
                ScrollController.ScrollToEnd(true);
            }
                ).Add(
                "Manipulation Test15. Has the last section been deleted?",
                async() =>
            {
                await Task.Delay(2000);
                ItemsSource.Remove(_additionalGroup);
                await Task.Delay(2000);
                ScrollController.ScrollToEnd(true);
            }
                ).Add(
                "Has Background turned from Yellow to White to Green to transparent?",
                async() =>
            {
                Background.Value = Color.Yellow;
                await Task.Delay(1000);
                Background.Value = Color.White;
                await Task.Delay(1000);
                Background.Value = Color.Green;
                await Task.Delay(1000);
                Background.Value = Color.Transparent;
            }
                ).Add(
                "Tap some cells. Has FeedBack color turned Red?",
                () =>
            {
                FeedbackColor.Value = Color.Red;
            },
                () =>
            {
                FeedbackColor.Value = Color.Yellow;
            }
                ).Add(
                "Has Spacing width been twice as large as previous?",
                () =>
            {
                Spacing.Value *= 2;
            },
                () =>
            {
                Spacing.Value /= 2;
            }
                ).Add(
                "Has Group First Spacing been 30px in Grouped?",
                () =>
            {
                GroupFirstSpacing.Value = 30;
            }
                ).Add(
                "Has Group Last Spacing been 30px in Grouped?",
                () =>
            {
                GroupLastSpacing.Value = 30;
            }
                ).Add(
                "Has Column width been twice as large as previous?",
                () =>
            {
                ColumnWidth.Value *= 2;
            },
                () => { ColumnWidth.Value /= 2; }
                ).Add(
                "Has GroupHeaderWidth been twice as large as previous?",
                () =>
            {
                GroupWidth.Value *= 2;
            },
                () =>
            {
                GroupWidth.Value /= 2;
            }
                ).Add(
                "Has Row height been one and a half as large as previous?",
                () =>
            {
                RowHeight.Value = 150;
            },
                () => { RowHeight.Value = 100; }
                ).Add(
                "Has Scroll come to circulate?",
                () =>
            {
                IsInfinite.Value = true;
            },
                () =>
            {
                IsInfinite.Value = false;
            }
                ).Add(
                "Change the device orientation Landscape, and Back to Portrait. Hasn't the layout broken?"
                );
        }