Browse Source

Fix Property Finding if ComponentType!=Component.GetType() for Example on WindowClone.

Maybe we need to do the same for Events? And maybe cache the Properties for a Type? (Not for a Instance!)
pull/586/head
jogibear9988 11 years ago
parent
commit
f9780edac0
  1. 12
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/XamlParser.cs

12
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.XamlDom/Project/XamlParser.cs

@ -457,13 +457,11 @@ namespace ICSharpCode.WpfDesign.XamlDom @@ -457,13 +457,11 @@ namespace ICSharpCode.WpfDesign.XamlDom
internal static XamlPropertyInfo FindProperty(object elementInstance, Type propertyType, string propertyName)
{
PropertyDescriptorCollection properties;
if (elementInstance != null) {
properties = TypeDescriptor.GetProperties(elementInstance);
} else {
properties = TypeDescriptor.GetProperties(propertyType);
}
PropertyDescriptor propertyInfo = properties[propertyName];
PropertyDescriptor propertyInfo = TypeDescriptor.GetProperties(propertyType)[propertyName];
if (propertyInfo == null && elementInstance != null)
propertyInfo = TypeDescriptor.GetProperties(elementInstance).OfType<DependencyPropertyDescriptor>().FirstOrDefault(x => x.IsAttached && x.Name == propertyName);
if (propertyInfo != null) {
return new XamlNormalPropertyInfo(propertyInfo);
} else {

Loading…
Cancel
Save