| 12345678910111213141516171819202122232425262728 |
- using System;
- using System.Globalization;
- using System.Windows.Controls;
- namespace Robot
- {
- public class NumValidation: ValidationRule
- {
- public override ValidationResult Validate(object value, CultureInfo cultureInfo)
- {
- if ((string) value == "")
- {
- return new ValidationResult(true, null);
- }
- try
- {
- int.Parse((string) value);
- }
- catch (Exception e)
- {
- return new ValidationResult(false,
- string.Format("Illegal characters or {0}", e.Message));
- }
- return new ValidationResult(true, null);
- }
- }
- }
|