Files
GotecHaftmittel/.svn/pristine/ef/ef73d5d0c3dfc73a13b9eefbad8d6e5ff564ddea.svn-base
2025-10-31 12:50:24 +01:00

39 lines
991 B
Plaintext

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Globalization;
using System.Windows.Controls;
namespace Haftmittel
{
public class ClassProcentyValidationRule : ValidationRule
{
public override ValidationResult Validate(object value, CultureInfo cultureInfo)
{
decimal procent = 0;
try
{
if (((string)value).Length > 0)
{
procent = decimal.Parse((String)value);
}
}
catch (Exception)
{
return new ValidationResult(false, "Nieprawidłowe znaki");
}
if ((procent < 0) || (procent > 100))
{
return new ValidationResult(false, "Wartość powinna być z zakresu: 0 - 100");
}
else
{
return new ValidationResult(true, null);
}
}
}
}