title: WPF TextBox input filtering doesn't work as expected with a decimal
body: <p>I am trying to filter the input to a WPF <code>TextBox</code> to prevent the user from entering non-numerical strings. I have configured <code>PreviewKeyDown</code> and am checking the characters entered with the code from <a href="https://stackoverflow.com/questions/5825820/how-to-capture-the-character-on-different-locale-keyboards-in-wpf-c">this question</a> to convert the key codes to characters. Everything works as expected except when the user enters a period. The code does detect a period was entered, yet when I return from <code>PreviewKeyDown</code> with setting <code>KeyEventArgs</code>'s <code>Handled</code> to false, it doesn't allow the period to be entered. </p>
  
  <p><strong>XAML</strong></p>
  
  <pre><code>&lt;TextBox PreviewKeyDown="TextBox_PreviewKeyDown"&gt;
      &lt;TextBox.Text&gt;
          &lt;Binding Source="{StaticResource SomeObject}" Path="SomePath" UpdateSourceTrigger="PropertyChanged"&gt;
              &lt;Binding.ValidationRules&gt;
                  &lt;local:MyValidationRule/&gt;
              &lt;/Binding.ValidationRules&gt;
          &lt;/Binding&gt;
      &lt;/TextBox.Text&gt;
  &lt;/TextBox&gt;
  </code></pre>
  
  <p><strong>C#</strong></p>
  
  <pre><code>private void TextBox_PreviewKeyDown(object sender, KeyEventArgs e)
  {
      char character = GetCharFromKey(e.Key);
  
      e.Handled = false;
      if (character &gt;= '0' &amp;&amp; character &lt;= '9')
          return;
      if (character == '.')
          return;
      switch(e.Key)
      {
          case Key.Delete:
          case Key.Back:
              return;
      }
      e.Handled = true;
  }
  </code></pre>