Exemple #1
0
        internal static void ParsePropertyPathParameters(XamlParserContext parserContext, ITextLocation lineInformation, IXmlNamespaceResolver xmlNamespaceResolver, string path, out string propertyPath, out IList <IProperty> pathParameters)
        {
            pathParameters = (IList <IProperty>) new List <IProperty>();
            StringBuilder stringBuilder = new StringBuilder();
            int           startIndex;
            int           num1;
            int           num2;

            for (startIndex = 0; (num1 = path.IndexOf('(', startIndex)) >= 0; startIndex = num2 + 1)
            {
                num2 = path.IndexOf(')', num1 + 1);
                if (num2 < 0)
                {
                    parserContext.ReportError(XamlParseErrors.InvalidPropertyPathSyntax(lineInformation, path));
                    startIndex = path.Length;
                    break;
                }
                string prefixAndTypeName = path.Substring(num1 + 1, num2 - num1 - 1);
                if (prefixAndTypeName.IndexOf('.') >= 0)
                {
                    stringBuilder.Append(path.Substring(startIndex, num1 - startIndex));
                    stringBuilder.Append('(');
                    stringBuilder.Append(pathParameters.Count);
                    stringBuilder.Append(')');
                    IProperty   property = (IProperty)null;
                    XmlnsPrefix prefix;
                    string      typeName;
                    if (XamlTypeHelper.SplitTypeName(parserContext, lineInformation, prefixAndTypeName, out prefix, out typeName))
                    {
                        XmlNamespace xmlNamespace = parserContext.GetXmlNamespace(lineInformation, xmlNamespaceResolver, prefix);
                        MemberType   memberTypes  = MemberType.Property | MemberType.Field;
                        if (parserContext.TypeResolver.IsCapabilitySet(PlatformCapability.IncompleteAttachedPropertiesInMarkupExtensions))
                        {
                            memberTypes |= MemberType.IncompleteAttachedProperty;
                        }
                        IMember member = (IMember)XamlTypeHelper.GetPropertyKey(parserContext, lineInformation, xmlNamespace, typeName, (XmlNamespace)null, (IType)null, memberTypes, MemberType.AttachedProperty, false);
                        if (member != null)
                        {
                            property = MarkupExtensionParser.VerifyMemberIsDependencyProperty(parserContext, lineInformation, member);
                        }
                    }
                    pathParameters.Add(property);
                }
                else
                {
                    stringBuilder.Append(path.Substring(startIndex, num2 - startIndex + 1));
                }
            }
            stringBuilder.Append(path.Substring(startIndex));
            propertyPath = stringBuilder.ToString();
        }