public static bool IsPermitted(Key inKey) { return(InputRules.IsDelOrBackspace(inKey) || inKey == Key.Tab || InputRules.IsNumberKey(inKey) || InputRules.IsArrowKey(inKey)); }
//stops people copy/pasting non-numbers in! private void NumberBoxTextChanged(object sender, TextChangedEventArgs e) { this.seriesSizeInput.Text = InputRules.SanitiseInput(this.seriesSizeInput.Text); }
//checks for numerical input private void NumberBoxPreviewKeyDown(object sender, KeyEventArgs e) { e.Handled = !InputRules.IsPermitted(e.Key); }