/// <summary> /// Increments the position in the list box. /// </summary> private void IncrementSelection() { if (ListBoxDirections.SelectedIndex == ListBoxDirections.Items.Count - 1) { _view.MoveCurrentToFirst(); } else { _view.MoveCurrentToNext(); } // Since the selected item was changed programmatically, scroll it into view. if (ListBoxDirections.SelectedItem != null) { ListBoxDirections.ScrollIntoView(ListBoxDirections.SelectedItem); } }
/// <summary> /// Decrements the position in the list box. /// </summary> private void DecrementSelection() { if (ListBoxDirections.SelectedIndex == -1) { _view.MoveCurrentToLast(); } else { _view.MoveCurrentToPrevious(); } // Since the selected item was changed programmatically, scroll it into view. if (ListBoxDirections.SelectedItem != null) { ListBoxDirections.ScrollIntoView(ListBoxDirections.SelectedItem); } }