public static DocumentNode CreateNodeFromTextValue(XamlParserContext parserContext, ITextLocation lineInformation, IDocumentNodeReference nodeReference, IXmlNamespaceResolver xmlNamespaceResolver, TypeConverter typeConverter, ITypeId valueTypeId, string value) { if (parserContext.PlatformMetadata.KnownTypes.DependencyProperty.IsAssignableFrom(valueTypeId)) { MemberType memberTypes = MemberType.Property | MemberType.Field; if (parserContext.TypeResolver.IsCapabilitySet(PlatformCapability.IncompleteAttachedPropertiesInMarkupExtensions)) { memberTypes |= MemberType.IncompleteAttachedProperty; } MemberType defaultType = value.IndexOf('.') >= 0 ? MemberType.AttachedProperty : MemberType.LocalProperty; IProperty propertyKey = XamlTypeHelper.GetPropertyKey(parserContext, lineInformation, xmlNamespaceResolver, value, (XmlNamespace)null, nodeReference.TargetType, memberTypes, defaultType, false); if (propertyKey == null) { return((DocumentNode)null); } MarkupExtensionParser.VerifyMemberIsDependencyProperty(parserContext, lineInformation, (IMember)propertyKey); return((DocumentNode)parserContext.DocumentContext.CreateNode(valueTypeId, (IDocumentNodeValue) new DocumentNodeMemberValue((IMember)propertyKey))); } if (parserContext.PlatformMetadata.KnownTypes.ICommand.IsAssignableFrom(valueTypeId)) { bool flag = typeConverter != null && !parserContext.PlatformMetadata.KnownTypes.CommandConverter.Equals((object)parserContext.TypeResolver.GetType(typeConverter.GetType())); if (value.IndexOf('.') < 0 || flag) { return((DocumentNode)parserContext.DocumentContext.CreateNode(valueTypeId, (IDocumentNodeValue) new DocumentNodeStringValue(value))); } IType typeId; string memberName; if (MarkupExtensionParser.GetTypeAndMemberName(parserContext, lineInformation, xmlNamespaceResolver, value, (IType)null, out typeId, out memberName)) { MemberAccessTypes allowableMemberAccess = TypeHelper.GetAllowableMemberAccess(parserContext.TypeResolver, typeId); IMember member = (IMember)typeId.GetMember(MemberType.LocalProperty | MemberType.Field, memberName, allowableMemberAccess) ?? XamlTypeHelper.AddMemberIfPossible(parserContext.PlatformMetadata, typeId, MemberType.LocalProperty, memberName); if (member != null) { return((DocumentNode)parserContext.DocumentContext.CreateNode(valueTypeId, (IDocumentNodeValue) new DocumentNodeMemberValue(member))); } parserContext.ReportError(XamlParseErrors.UnrecognizedOrInaccessibleMember(lineInformation, memberName)); } return((DocumentNode)null); } if (parserContext.PlatformMetadata.KnownTypes.RoutedEvent.IsAssignableFrom(valueTypeId)) { IType typeId; string memberName; if (!MarkupExtensionParser.GetTypeAndMemberName(parserContext, lineInformation, xmlNamespaceResolver, value, nodeReference.TargetType, out typeId, out memberName)) { return((DocumentNode)null); } MemberAccessTypes allowableMemberAccess = TypeHelper.GetAllowableMemberAccess(parserContext.TypeResolver, typeId); IMember member = (IMember)typeId.GetMember(MemberType.Event, memberName, allowableMemberAccess); if (member != null) { MarkupExtensionParser.VerifyMemberIsRoutedEvent(parserContext, lineInformation, member); } else { member = XamlTypeHelper.AddMemberIfPossible(parserContext.PlatformMetadata, typeId, MemberType.RoutedEvent, memberName); } if (member != null) { return((DocumentNode)parserContext.DocumentContext.CreateNode(valueTypeId, (IDocumentNodeValue) new DocumentNodeMemberValue(member))); } parserContext.ReportError(XamlParseErrors.UnrecognizedOrInaccessibleMember(lineInformation, memberName)); return((DocumentNode)null); } if (parserContext.PlatformMetadata.KnownTypes.Delegate.IsAssignableFrom(valueTypeId)) { string memberName = value; if (parserContext.RootClassAttributes == null && parserContext.TypeResolver.IsCapabilitySet(PlatformCapability.IsWpf)) { parserContext.ReportError(XamlParseErrors.CannotDetermineMemberTargetType(lineInformation, memberName)); } return((DocumentNode)parserContext.DocumentContext.CreateNode(valueTypeId, (IDocumentNodeValue) new DocumentNodeStringValue(memberName))); } if (parserContext.PlatformMetadata.KnownTypes.PropertyPath.IsAssignableFrom(valueTypeId)) { return(MarkupExtensionParser.ParsePropertyPath(parserContext, lineInformation, xmlNamespaceResolver, value)); } if (parserContext.PlatformMetadata.KnownTypes.Uri.IsAssignableFrom(valueTypeId)) { return((DocumentNode)parserContext.DocumentContext.CreateNode(valueTypeId, (IDocumentNodeValue) new DocumentNodeStringValue(value))); } if (parserContext.PlatformMetadata.KnownTypes.Type.IsAssignableFrom(valueTypeId)) { IType typeId = XamlTypeHelper.GetTypeId(parserContext, lineInformation, xmlNamespaceResolver, value, false); if (typeId != null) { return((DocumentNode)parserContext.DocumentContext.CreateNode(valueTypeId, (IDocumentNodeValue) new DocumentNodeMemberValue((IMember)typeId))); } return((DocumentNode)null); } if (valueTypeId.Equals((object)parserContext.TypeResolver.PlatformMetadata.KnownTypes.Object)) { valueTypeId = (ITypeId)parserContext.TypeResolver.ResolveType(parserContext.TypeResolver.PlatformMetadata.KnownTypes.String); } if (valueTypeId.IsResolvable && valueTypeId != parserContext.TypeResolver.ResolveType(parserContext.TypeResolver.PlatformMetadata.KnownTypes.String) && (typeConverter == null || !typeConverter.CanConvertFrom(typeof(string)))) { parserContext.ReportError(XamlParseErrors.CannotConvertFromString(lineInformation, valueTypeId)); } return((DocumentNode)parserContext.DocumentContext.CreateNode(valueTypeId, (IDocumentNodeValue) new DocumentNodeStringValue(value))); }