From 3cda7774c553e5290c6a54f879c02e04d5c0ede6 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Sat, 24 Oct 2015 02:33:30 +0200 Subject: [PATCH] Use GetRuntimeProperty here. As it automatically looks in base classes. --- .../Binding/PropertyAccessorNode.cs | 23 +------------------ 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/src/Markup/Perspex.Markup/Binding/PropertyAccessorNode.cs b/src/Markup/Perspex.Markup/Binding/PropertyAccessorNode.cs index f5c6c293a2..da04879cb4 100644 --- a/src/Markup/Perspex.Markup/Binding/PropertyAccessorNode.cs +++ b/src/Markup/Perspex.Markup/Binding/PropertyAccessorNode.cs @@ -49,7 +49,7 @@ namespace Perspex.Markup.Binding if (target != null) { - _propertyInfo = FindProperty(target, PropertyName); + _propertyInfo = target.GetType().GetRuntimeProperty(PropertyName); if (_propertyInfo != null) { @@ -87,27 +87,6 @@ namespace Perspex.Markup.Binding _propertyInfo = null; } - private static PropertyInfo FindProperty(object target, string propertyName) - { - var typeInfo = target.GetType().GetTypeInfo(); - - do - { - var result = typeInfo.GetDeclaredProperty(propertyName); - - if (result != null) - { - return result; - } - else - { - typeInfo = typeInfo.BaseType?.GetTypeInfo(); - } - } while (typeInfo != null); - - return null; - } - private void ReadValue(object target) { var value = _propertyInfo.GetValue(target);