title: DataAnnotations attribute for float.NaN
body: <p>I am using <code>DataAnnotations</code> for validation of my <code>ViewModel</code> <code>(WPF)</code> so I can control the enable state of some buttons if the user type in a something that is not a float and if the value is outside of a range.</p>
  
  <pre><code>    [Range(0, float.MaxValue, ErrorMessage = "StepSize must be more than 0")]
              public float StepSize
              {
                  get { return model.StepSize; }
                  set
                  {                   
                      model.StepSize = value;
                      RaisePropertyChangedAndRevalidate(nameof(StepSize));
                  }
              }
  
  private void RaisePropertyChangedAndRevalidate(string propertyName)
          {
              RaisePropertyChanged(propertyName);
              if (_fieldBindingErrors == 0)
              {
                  RaisePropertyChanged(nameof(IsValid));
              }
          }
  
  
          private int _fieldBindingErrors = 0;
          public ICommand RegisterFieldBindingErrors
          {
              get
              {
                  return new RelayCommand&lt;ValidationErrorEventArgs&gt;(e =&gt;
                  {
                      if (e.Action == ValidationErrorEventAction.Added)
                      {
                          _fieldBindingErrors++;
                      }
                      else
                      {
                          _fieldBindingErrors--;
                      }
                      RaisePropertyChanged(nameof(IsValid));
                  });
              }
          }
  
          public bool IsValid
          {
              get
              {
                  bool valid = Validator.TryValidateObject(this,
                                     new ValidationContext(this, null, null),
                                     new List&lt;System.ComponentModel.DataAnnotations.ValidationResult&gt;())
                                     &amp;&amp; _fieldBindingErrors == 0;
  
                  return valid;
              }
          }
  </code></pre>
  
  <p>Problem is, when I convert the the textbox.Text string to a float I have to set the value to something not valid (should work for general cases also when the Range attribute is not in use). So I set the value to float.NaN.
  The problem is that NaN seems to be a valid float, and it even passes the Range validation above.</p>
  
  <p>Is there an attribute I could use to validate that the value is not NaN?</p>