public void MePullParser_Parse () { const string me = "{Binding 1, 2, Path=Name, Converter={StaticResource MyRes}, ConverterParameter={x:Static Window.LeftProperty}}"; var xamlGenerator = new XamlGenerator(null, null, null); var xamlSchema = new XamlSchemaContext( /*new[] { PresentationCore, PresentationFramework }*/); var xamlContext = new XamlParserContext(xamlSchema, GetType().Assembly); xamlContext.AddNamespacePrefix("", xamlGenerator.Ns.NamespaceName); xamlContext.AddNamespacePrefix("x", xamlGenerator.NsX.NamespaceName); var meParser = new MePullParser(xamlContext); var sb = new StringBuilder(); foreach (XamlNode xamlNode in meParser.Parse(me, 0, 0)) sb.AppendFormat("{0}\n", xamlNode); //throw new Exception(SR.Get("MissingImplicitPropertyTypeCase")); throw new Exception(sb.ToString()); }
public XamlGenerator (JObject data, string nameSpace, string className) { _data = data; NameSpace = nameSpace; ClassName = className; Converters = new List<ConverterInfo>(); NsMy = String.Format("{0}:{1}", KnownStrings.UriClrNamespace, NameSpace); _xamlSchemaContext = new XamlSchemaContext( /*new[] { PresentationCore, PresentationFramework }*/); _propertyShortcuts = GetType().Assembly.GetTypes() .Where(t => t.GetInterface(typeof(IPropertyShortcut).FullName) != null) .Select(t => (IPropertyShortcut)Activator.CreateInstance(t)) .ToList(); }