private static void OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e) { UseLevelSpinner control = (UseLevelSpinner)sender; // When someone click on a part in the NumericUpDown and it's not focusable // NumericUpDown needs to take the focus in order to process keyboard correctly if (!control.IsKeyboardFocusWithin) { e.Handled = control.Focus() || e.Handled; } }