示例#1
0
 protected PropertyInfo GetPropertyInfo(string propertyName)
 {
     return
         (ProxiedObject.GetType()
          .GetProperties()
          .FirstOrDefault(propertyInfo => propertyInfo.Name == propertyName));
 }
        public virtual bool Validate()
        {
            var propertiesToValidate =
                ProxiedObject.GetType()
                .GetProperties()
                .Where(pi => pi.GetCustomAttributes(typeof(ValidationAttribute), true).Length > 0);

            foreach (var item in propertiesToValidate)
            {
                Validate(item);
            }

            return(false);
        }
示例#3
0
 public override bool TryConvert(ConvertBinder binder, out object result)
 {
     if (binder.Type == typeof(INotifyPropertyChanged))
     {
         result = this;
         return(true);
     }
     if (ProxiedObject != null && binder.Type.IsAssignableFrom(ProxiedObject.GetType()))
     {
         result = ProxiedObject;
         return(true);
     }
     else
     {
         return(base.TryConvert(binder, out result));
     }
 }
示例#4
0
 private PropertyInfo GetPropertyInfo(string propertyName)
 {
     return(ProxiedObject.GetType().GetProperties().First(propertyInfo => propertyInfo.Name == propertyName));
 }