|
1234567891011121314151617181920212223 |
- using HandyControl.Tools.Extension;
- using System;
- using System.Collections.Generic;
- using System.Globalization;
- using System.Linq;
- using System.Text;
- using System.Text.RegularExpressions;
- using System.Threading.Tasks;
- using System.Windows.Controls;
-
- namespace HKCardIN
- {
- public class ValidataRule : ValidationRule
- {
- public override ValidationResult Validate(object value, CultureInfo cultureInfo)
- {
- if(value.ToString().IsNullOrEmpty()) return ValidationResult.ValidResult;
- var reg = Regex.IsMatch(value.ToString(), "\\d+");
- if (!reg) return new ValidationResult(false, "请输入正整数");
- else return ValidationResult.ValidResult;
- }
- }
- }
|