WPF 禁止在文本框中输入数字
private void textBox1_PreviewTextInput(object sender, TextCompositionEventArgs e) { e.Handled = System.Text.RegularExpressions.Regex.IsMatch(e.Text, @"[0-9]+"); base.OnPreviewTextInput(e); }
private void textBox1_PreviewTextInput(object sender, TextCompositionEventArgs e) { e.Handled = System.Text.RegularExpressions.Regex.IsMatch(e.Text, @"[0-9]+"); base.OnPreviewTextInput(e); }