コード例 #1
0
 protected PropertyInfo GetPropertyInfo(string propertyName)
 {
     return
         (ProxiedObject.GetType()
          .GetProperties()
          .FirstOrDefault(propertyInfo => propertyInfo.Name == propertyName));
 }
コード例 #2
0
        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));
 }