21 lines
		
	
	
		
			579 B
		
	
	
	
		
			C#
		
	
	
	
		
		
			
		
	
	
			21 lines
		
	
	
		
			579 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 DM_Weight.Validation
							 | 
						|||
| 
								 | 
							
								{
							 | 
						|||
| 
								 | 
							
								    public class NotEmptyValidationRule : ValidationRule
							 | 
						|||
| 
								 | 
							
								    {
							 | 
						|||
| 
								 | 
							
								        public override ValidationResult Validate(object value, CultureInfo cultureInfo)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            return string.IsNullOrWhiteSpace((value ?? "").ToString())
							 | 
						|||
| 
								 | 
							
								                ? new ValidationResult(false, "字段不能为空")
							 | 
						|||
| 
								 | 
							
								                : ValidationResult.ValidResult;
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								    }
							 | 
						|||
| 
								 | 
							
								}
							 |