You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
729 B
C#
27 lines
729 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Globalization;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Controls;
|
|
|
|
namespace XGLFinishPro.Tools
|
|
{
|
|
public class NumericValidationRule : ValidationRule
|
|
{
|
|
public override ValidationResult Validate(object value, CultureInfo cultureInfo)
|
|
{
|
|
double result;
|
|
if (double.TryParse(value as string, NumberStyles.Any, CultureInfo.InvariantCulture, out result))
|
|
{
|
|
return ValidationResult.ValidResult;
|
|
}
|
|
else
|
|
{
|
|
return new ValidationResult(false, "Invalid numeric value");
|
|
}
|
|
}
|
|
}
|
|
}
|