Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Forked from VECTO / VECTO Sim
5040 commits behind the upstream repository.
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
DoubleValidation.cs 429 B
using System;
using System.Globalization;
using System.Windows.Controls;

namespace VECTO3GUI2020.Helper
{
	public class DoubleValidation : ValidationRule
	{
		public override ValidationResult Validate(object value, CultureInfo cultureInfo)
		{
			try {
				Double.Parse(value as string);
			} catch (Exception e) {
				return new ValidationResult(false, "Not a number");
			}

			return ValidationResult.ValidResult;
		}
	}
}