protected override IBindingMemberInfo GetExplicitBindingMember(Type sourceType, string path) { if (typeof(DependencyObject).IsAssignableFrom(sourceType)) { var property = GetDependencyProperty(sourceType, path); if (property != null) { IBindingMemberInfo updateEvent = BindingServiceProvider.UpdateEventFinder(sourceType, path); #if WPF return(new DependencyPropertyBindingMember(property, path, property.PropertyType, property.ReadOnly, sourceType.GetProperty(path), updateEvent)); #else var member = sourceType.GetPropertyEx(path); Type type = typeof(object); bool readOnly = false; if (member != null) { type = member.PropertyType; readOnly = !member.CanWrite; } return(new DependencyPropertyBindingMember(property, path, type, readOnly, member, updateEvent)); #endif } } return(base.GetExplicitBindingMember(sourceType, path)); }
public BindingMemberInfo([NotNull] string path, [NotNull] PropertyInfo property, Type sourceType) : this(path, BindingMemberType.Property, property.PropertyType) { _member = property; var method = property.GetGetMethod(true); if (method == null) { _getValueAccessorSingle = NotSupportedGetter; _canRead = false; } else { _getValueAccessorSingle = InitiliazePropertyGetter; _canRead = true; } method = property.GetSetMethod(true); if (method == null) { _setValueAccessorSingle = NotSupportedSetter; _canWrite = false; } else { _setValueAccessorSingleAction = InitiliazePropertySetter; _canWrite = true; } _isSingleParameter = true; _memberEvent = BindingServiceProvider.UpdateEventFinder(sourceType, property.Name); _canObserve = _memberEvent != null; }
public BindingMemberInfo([NotNull] string path, [NotNull] FieldInfo field, Type sourceType) : this(path, BindingMemberType.Field, field.FieldType) { _member = field; _getValueAccessorSingle = InitiliazeFieldGetter; _setValueAccessorSingleAction = InitializeFieldSetter; _canRead = true; _canWrite = true; _isSingleParameter = true; _memberEvent = BindingServiceProvider.UpdateEventFinder(sourceType, field.Name); _canObserve = _memberEvent != null; }
public BindingMemberInfo([NotNull] string path, [NotNull] FieldInfo field, Type sourceType) : this(path, BindingMemberType.Field, field.FieldType) { _member = field; _getValueAccessorSingle = ServiceProvider.ReflectionManager.GetMemberGetter <object>(field); _setValueAccessorSingleAction = ServiceProvider.ReflectionManager.GetMemberSetter <object>(field); _canRead = true; _canWrite = true; _isSingleParameter = true; _memberEvent = BindingServiceProvider.UpdateEventFinder(sourceType, field.Name); _canObserve = _memberEvent != null; }