コード例 #1
0
        public void Test_GoToPrevious()
        {
            var input = new CyclicIteratableList <int>(new List <int> {
                1, 2, 3
            });

            input.GoToPrevious();
            Assert.IsTrue(input.GetCurrent() == 3);
            input.GoToPrevious();
            Assert.IsTrue(input.GetCurrent() == 2);
            input.GoToPrevious();
            Assert.IsTrue(input.GetCurrent() == 1);
        }
コード例 #2
0
        public void Test_AtLast()
        {
            var input = new CyclicIteratableList <int>(new List <int> {
                1, 2, 3
            });

            input.GoToPrevious();
            Assert.IsTrue(input.AtLast());
        }
コード例 #3
0
        public void NavigateToPrevious()
        {
            _iteratableList.GoToPrevious();
            DefocusLastFocused();
            var current = _iteratableList.GetCurrent();

            if (current != null)
            {
                current.IsFocused = true;
            }
        }
コード例 #4
0
        private void SearchBox_OnOnKeyPressed(object sender, KeyEventArgs e)
        {
            switch (e.Key)
            {
            case Key.Up:
            case Key.Left:
                _iteratableList.GoToPrevious();
                var current1 = (CheckBoxWithListDownMenu)_iteratableList.GetCurrent();
                if (current1 == null)
                {
                    return;
                }
                current1.Highlight();
                if (_iteratableList.AtLast())
                {
                    ScrollViewer.ScrollToBottom();
                }
                else if (!current1.IsVisibleToUser(ScrollViewer))
                {
                    ScrollViewer.PageUp();
                }
                break;

            case Key.Down:
            case Key.Right:
                _iteratableList.GoToNext();
                var current = (CheckBoxWithListDownMenu)_iteratableList.GetCurrent();
                if (current == null)
                {
                    return;
                }
                current.Highlight();
                if (_iteratableList.AtFirst())
                {
                    ScrollViewer.ScrollToHome();
                }
                else if (!current.IsVisibleToUser(ScrollViewer))
                {
                    ScrollViewer.PageDown();
                }
                break;

            case Key.Enter:
                var current2 = (CheckBoxWithListDownMenu)_iteratableList.GetCurrent();
                if (current2 == null)
                {
                    return;
                }
                current2.IsChecked = !_iteratableList.GetCurrent().IsChecked;
                break;

            default: break;
            }
        }