コード例 #1
0
ファイル: XamlContext.cs プロジェクト: Athari/Alba.Jaml
 public string GetAttributeNamespace (XamlPropertyName propName, string tagNamespace)
 {
     if (string.IsNullOrEmpty(propName.Prefix) && !propName.IsDotted) {
         return tagNamespace;
     }
     return this.ResolveXamlNameNS(propName);
 }
コード例 #2
0
ファイル: XamlContext.cs プロジェクト: Athari/Alba.Jaml
 public XamlMember GetDottedProperty (XamlType tagType, string tagNamespace, XamlPropertyName propName, bool tagIsRoot)
 {
     if (tagType == null) {
         throw new XamlInternalException(SR.Get("ParentlessPropertyElement", new object[] { propName.ScopedName }));
     }
     XamlMember xamlAttachableProperty = null;
     XamlType xamlType = null;
     string propNs = this.ResolveXamlNameNS(propName);
     if (propNs == null) {
         throw new XamlParseException(SR.Get("PrefixNotFound", new object[] { propName.Prefix }));
     }
     XamlType rootTagType = tagIsRoot ? tagType : null;
     bool flag = false;
     if (tagType.IsGeneric) {
         flag = this.PropertyTypeMatchesGenericTagType(tagType, tagNamespace, propNs, propName.OwnerName);
         if (flag) {
             xamlAttachableProperty = this.GetInstanceOrAttachableProperty(tagType, propName.Name, rootTagType);
             if (xamlAttachableProperty != null) {
                 return xamlAttachableProperty;
             }
         }
     }
     XamlTypeName typeName = new XamlTypeName(propNs, propName.Owner.Name);
     xamlType = this.GetXamlType(typeName, true);
     bool flag2 = tagType.CanAssignTo(xamlType);
     if (flag2) {
         xamlAttachableProperty = this.GetInstanceOrAttachableProperty(xamlType, propName.Name, rootTagType);
     }
     else {
         xamlAttachableProperty = this.GetXamlAttachableProperty(xamlType, propName.Name);
     }
     if (xamlAttachableProperty != null) {
         return xamlAttachableProperty;
     }
     XamlType declaringType = flag ? tagType : xamlType;
     if (flag || flag2) {
         return this.CreateUnknownMember(declaringType, propName.Name);
     }
     return this.CreateUnknownAttachableMember(declaringType, propName.Name);
 }
コード例 #3
0
ファイル: XamlContext.cs プロジェクト: Athari/Alba.Jaml
 public XamlMember GetNoDotAttributeProperty (XamlType tagType, XamlPropertyName propName, string tagNamespace, string propUsageNamespace, bool tagIsRoot)
 {
     XamlMember xamlAttachableProperty = null;
     if ((propUsageNamespace == tagNamespace) || (((tagNamespace == null) && (propUsageNamespace != null)) && tagType.GetXamlNamespaces().Contains(propUsageNamespace))) {
         XamlType rootObjectType = tagIsRoot ? tagType : null;
         xamlAttachableProperty = this.GetXamlProperty(tagType, propName.Name, rootObjectType);
         if (xamlAttachableProperty == null) {
             xamlAttachableProperty = this.GetXamlAttachableProperty(tagType, propName.Name);
         }
     }
     if ((xamlAttachableProperty == null) && (propUsageNamespace != null)) {
         XamlDirective xamlDirective = this.SchemaContext.GetXamlDirective(propUsageNamespace, propName.Name);
         if (xamlDirective != null) {
             if ((xamlDirective.AllowedLocation & AllowedMemberLocations.Attribute) == AllowedMemberLocations.None) {
                 xamlDirective = new XamlDirective(propUsageNamespace, propName.Name);
             }
             xamlAttachableProperty = xamlDirective;
         }
     }
     if (xamlAttachableProperty != null) {
         return xamlAttachableProperty;
     }
     if (tagNamespace == propUsageNamespace) {
         return new XamlMember(propName.Name, tagType, false);
     }
     return new XamlDirective(propUsageNamespace, propName.Name);
 }