diff --git a/src/Markup/Perspex.Markup.Xaml/Binding/XamlTemplateBinding.cs b/src/Markup/Perspex.Markup.Xaml/Binding/XamlTemplateBinding.cs index 84794386a6..6a5fdf36a6 100644 --- a/src/Markup/Perspex.Markup.Xaml/Binding/XamlTemplateBinding.cs +++ b/src/Markup/Perspex.Markup.Xaml/Binding/XamlTemplateBinding.cs @@ -40,7 +40,9 @@ namespace Perspex.Markup.Xaml.Binding PerspexProperty targetProperty, PerspexObject templatedParent) { - var sourceProperty = PerspexPropertyRegistry.Instance.FindRegistered(instance.GetType(), SourcePropertyPath); + var sourceProperty = PerspexPropertyRegistry.Instance.FindRegistered( + templatedParent, + SourcePropertyPath); if (sourceProperty == null) { diff --git a/src/Perspex.Base/PerspexPropertyRegistry.cs b/src/Perspex.Base/PerspexPropertyRegistry.cs index 2c388131fa..85f9e275b1 100644 --- a/src/Perspex.Base/PerspexPropertyRegistry.cs +++ b/src/Perspex.Base/PerspexPropertyRegistry.cs @@ -179,6 +179,28 @@ namespace Perspex return results.FirstOrDefault(x => x.Name == propertyName); } + + /// + /// Finds a registered property on an object by name. + /// + /// The object. + /// + /// The property name. If an attached property it should be in the form + /// "OwnerType.PropertyName". + /// + /// + /// The registered property or null if no matching property found. + /// + public PerspexProperty FindRegistered(PerspexObject o, string name) + { + return FindRegistered(o.GetType(), name); + } + + /// + /// Returns a type and all its base types. + /// + /// The type. + /// The type and all its base types. private IEnumerable GetImplementedTypes(Type type) { while (type != null)