public XamlMember(ParameterInfo parameterInfo, XamlSchemaContext schemaContext, XamlMemberInvoker invoker) : this(schemaContext, invoker) { var declaringType = schemaContext.GetXamlType(parameterInfo.Member.DeclaringType); Name = parameterInfo.Name; context = declaringType.SchemaContext; DeclaringType = declaringType; target_type = DeclaringType; type = schemaContext.GetXamlType(parameterInfo.ParameterType); }
protected virtual XamlType LookupItemType() { XamlType itemType; var kind = CollectionKind; if (kind == XamlCollectionKind.Array) { itemType = SchemaContext.GetXamlType(type.GetElementType()); } else if (kind == XamlCollectionKind.Dictionary) { if (!IsGeneric) { itemType = SchemaContext.GetXamlType(typeof(object)); } else { itemType = SchemaContext.GetXamlType(type.GetTypeInfo().GetGenericArguments()[1]); } } else if (kind != XamlCollectionKind.Collection) { return(null); } else if (!IsGeneric) { // support custom collections that inherit ICollection<T> var collectionType = type.GetTypeInfo().GetInterfaces().FirstOrDefault(r => r.GetTypeInfo().IsGenericType&& r.GetGenericTypeDefinition() == typeof(ICollection <>)); if (collectionType != null) { itemType = SchemaContext.GetXamlType(collectionType.GetTypeInfo().GetGenericArguments()[0]); } else { itemType = SchemaContext.GetXamlType(typeof(object)); } } else { itemType = SchemaContext.GetXamlType(type.GetTypeInfo().GetGenericArguments()[0]); } return(itemType); }
internal XamlMember(bool isDirective, string ns, string name) { this.ns = ns; Name = name; flags.Set(MemberFlags.IsDirective, isDirective); }