示例#1
0
 private static object ForceText(DependencyObject sender, object value)
 {
     if (!NumericTextBox.AreAllValidNumericChars((IEnumerable <char>)(string) value))
     {
         throw new ArgumentException();
     }
     else
     {
         return(value);
     }
 }
示例#2
0
 protected override void OnPreviewTextInput(TextCompositionEventArgs e)
 {
     e.Handled = !NumericTextBox.AreAllValidNumericChars((IEnumerable <char>)e.Text);
     base.OnPreviewTextInput(e);
 }