title: How TextBox accepts positive and negative decimal values in WPF
body: <p>In my projcet(WPF) textbox allow only positive and negative decimal numbers .I used Regular expression then it accepts -.values.but it is taking the values like this </p>
  
  <p>-123.-2 it is not correct.my requirement is it accepts like this</p>
  
  <p>233334
  -233333
  -2.3444</p>
  
  <p>I used this code.</p>
  
  <pre><code>    private void NumericOnly(System.Object sender, System.Windows.Input.TextCompositionEventArgs e)
      {
          e.Handled = IsTextNumeric(e.Text);
  
      }
  
  
      private static bool IsTextNumeric(string str)
      {
          System.Text.RegularExpressions.Regex reg = new System.Text.RegularExpressions.Regex("[^0-9.-]");
          return reg.IsMatch(str);
  
      }
  </code></pre>
  
  <p>Somebody please help me.How that text box accepts positive and negative decimal numeric values.</p>