static private FindProperty ( object elementInstance, Type propertyType, string propertyName ) : XamlPropertyInfo | ||
elementInstance | object | |
propertyType | Type | |
propertyName | string | |
return | XamlPropertyInfo |
public XamlPropertyInfo ResolveProperty(string propertyName) { string propertyNamespace; if (propertyName.Contains(":")) { propertyNamespace = ContainingElement.GetNamespaceOfPrefix(propertyName.Substring(0, propertyName.IndexOf(':'))); propertyName = propertyName.Substring(propertyName.IndexOf(':') + 1); } else { propertyNamespace = ContainingElement.GetNamespaceOfPrefix(""); } Type elementType = null; XamlObject obj = containingObject; while (obj != null) { Style style = obj.Instance as Style; if (style != null && style.TargetType != null) { elementType = style.TargetType; break; } obj = obj.ParentObject; } if (propertyName.Contains(".")) { var allPropertiesAllowed = this.containingObject is XamlObject && (((XamlObject)this.containingObject).ElementType == typeof(Setter) || ((XamlObject)this.containingObject).IsMarkupExtension); return(XamlParser.GetPropertyInfo(document.TypeFinder, null, elementType, propertyNamespace, propertyName, allPropertiesAllowed)); } else if (elementType != null) { return(XamlParser.FindProperty(null, elementType, propertyName)); } else { return(null); } }
public XamlPropertyInfo ResolveProperty(string propertyName) { string propertyNamespace; if (propertyName.Contains(":")) { propertyNamespace = ContainingElement.GetNamespaceOfPrefix(propertyName.Substring(0, propertyName.IndexOf(':'))); propertyName = propertyName.Substring(propertyName.IndexOf(':') + 1); } else { propertyNamespace = ContainingElement.GetNamespaceOfPrefix(""); } Type elementType = null; XamlObject obj = containingObject; while (obj != null) { Style style = obj.Instance as Style; if (style != null && style.TargetType != null) { elementType = style.TargetType; break; } obj = obj.ParentObject; } if (propertyName.Contains(".")) { return(XamlParser.GetPropertyInfo(document.TypeFinder, null, elementType, propertyNamespace, propertyName)); } else if (elementType != null) { return(XamlParser.FindProperty(null, elementType, propertyName)); } else { return(null); } }