private void Increment(object sender, RoutedEventArgs e) { if (Value < Maximum) { Value += Step; if (Value > Maximum) { Value = Maximum; } } else if (Loop) { LoopIncrementCommand?.Execute(null); } }
protected override void OnPreviewKeyDown(KeyEventArgs e) { if (Loop) { if (SelectedIndex == 0 && e.Key == Key.Up) { LoopDecrementCommand?.Execute(null); e.Handled = true; return; } if (SelectedIndex == Items.Count - 1 && e.Key == Key.Down) { LoopIncrementCommand?.Execute(null); e.Handled = true; return; } } base.OnPreviewKeyDown(e); }