private static void OnPaste(object sender, DataObjectPastingEventArgs e)
 {
     if (e.DataObject.GetDataPresent(typeof(string)))
     {
         if (NumericBehavior.IsTextAllowed((string)e.DataObject.GetData(typeof(string))))
         {
             return;
         }
         e.CancelCommand();
     }
     else
     {
         e.CancelCommand();
     }
 }
 private static void TextBox_PreviewTextInput(object sender, TextCompositionEventArgs e)
 {
     e.Handled = !NumericBehavior.IsTextAllowed(e.Text);
 }