namespace GDNXFD.Alert.Config.Validations
{
using GDNXFD.Alert.Config.ViewModel;
using System;
using System.Windows.Controls;
using System.Windows.Data;
///
/// Rule for required fields
///
public class SelectedAlertCategoryValidationRule : ValidationRule
{
///
/// When overridden in a derived class, performs validation checks on a value.
///
/// The value from the binding target to check.
/// The culture to use in this rule.
///
/// A object.
///
public override ValidationResult Validate(object value, System.Globalization.CultureInfo cultureInfo)
{
if (((RuleFormViewModel)((((BindingExpression)(value)).DataItem))).SelectedAlertCategory == null)
return new ValidationResult(false, "必须选择一个有效值!");
return new ValidationResult(true, null);
}
}
}