本文整理汇总了C#中System.Windows.Data.BindingGroup.GetValue方法的典型用法代码示例。如果您正苦于以下问题:C# BindingGroup.GetValue方法的具体用法?C# BindingGroup.GetValue怎么用?C# BindingGroup.GetValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Data.BindingGroup
的用法示例。
在下文中一共展示了BindingGroup.GetValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Validate
public class AreasMatch : ValidationRule
{
public override ValidationResult Validate(object value, System.Globalization.CultureInfo cultureInfo)
{
BindingGroup bg = value as BindingGroup;
Customer cust = bg.Items[0] as Customer;
if (cust == null)
{
return new ValidationResult(false, "Customer is not the source object");
}
Region region = (Region)bg.GetValue(cust, "Location");
ServiceRep rep = bg.GetValue(cust, "ServiceRepresentative") as ServiceRep;
string customerName = bg.GetValue(cust, "Name") as string;
if (region == rep.Area)
{
return ValidationResult.ValidResult;
}
else
{
StringBuilder sb = new StringBuilder();
sb.AppendFormat("{0} must be assigned a sales representative that serves the {1} region. \n ", customerName, region);
return new ValidationResult(false, sb.ToString());
}
}
}