public void Test_GoToNext() { var input = new CyclicIteratableList <int>(new List <int> { 1, 2, 3 }); input.GoToNext(); Assert.IsTrue(input.GetCurrent() == 2); input.GoToNext(); Assert.IsTrue(input.GetCurrent() == 3); input.GoToNext(); Assert.IsTrue(input.GetCurrent() == 1); }
public void NavigateToNext() { _iteratableList.GoToNext(); DefocusLastFocused(); var current = _iteratableList.GetCurrent(); if (current != null) { current.IsFocused = true; } }
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; } }