예제 #1
0
        internal XamlServiceProvider(INode node, HydrationContext context)
        {
            object targetObject;

            if (node != null && node.Parent != null && context.Values.TryGetValue(node.Parent, out targetObject))
            {
                IProvideValueTarget = new XamlValueTargetProvider(targetObject, node, context, null);
            }
            if (context != null)
            {
                IRootObjectProvider = new XamlRootObjectProvider(context.RootElement);
            }
            if (node != null)
            {
                IXamlTypeResolver = new XamlTypeResolver(node.NamespaceResolver, XamlParser.GetElementType,
                                                         context.RootElement.GetType().GetTypeInfo().Assembly);

                Add(typeof(IReferenceProvider), new ReferenceProvider(node));
            }

            var xmlLineInfo = node as IXmlLineInfo;

            if (xmlLineInfo != null)
            {
                IXmlLineInfoProvider = new XmlLineInfoProvider(xmlLineInfo);
            }

            IValueConverterProvider = new ValueConverterProvider();
        }
예제 #2
0
		internal XamlServiceProvider(INode node, HydratationContext context)
		{
			object targetObject;
			if (node != null && node.Parent != null && context.Values.TryGetValue(node.Parent, out targetObject))
				IProvideValueTarget = new XamlValueTargetProvider(targetObject, node, context, null);
			if (context != null)
				IRootObjectProvider = new XamlRootObjectProvider(context.RootElement);
			if (node != null)
			{
				IXamlTypeResolver = new XamlTypeResolver(node.NamespaceResolver, XamlParser.GetElementType,
					context.RootElement.GetType().GetTypeInfo().Assembly);

				var enode = node;
				while (enode != null && !(enode is IElementNode))
					enode = enode.Parent;
				if (enode != null)
					INameScopeProvider = new NameScopeProvider { NameScope = (enode as IElementNode).Namescope };
			}

			var xmlLineInfo = node as IXmlLineInfo;
			if (xmlLineInfo != null)
				IXmlLineInfoProvider = new XmlLineInfoProvider(xmlLineInfo);

			IValueConverterProvider = new ValueConverterProvider();
		}
예제 #3
0
        internal XamlServiceProvider(INode node, HydratationContext context)
        {
            object targetObject;

            if (node != null && node.Parent != null && context.Values.TryGetValue(node.Parent, out targetObject))
            {
                IProvideValueTarget = new XamlValueTargetProvider(targetObject, node, context, null);
            }
            if (context != null)
            {
                IRootObjectProvider = new XamlRootObjectProvider(context.RootElement);
            }
            if (node != null)
            {
                IXamlTypeResolver = new XamlTypeResolver(node.NamespaceResolver, XamlParser.GetElementType,
                                                         context.RootElement.GetType().GetTypeInfo().Assembly);

                var enode = node;
                while (enode != null && !(enode is IElementNode))
                {
                    enode = enode.Parent;
                }
                if (enode != null)
                {
                    INameScopeProvider = new NameScopeProvider {
                        NameScope = (enode as IElementNode).Namescope
                    }
                }
                ;
            }

            var xmlLineInfo = node as IXmlLineInfo;

            if (xmlLineInfo != null)
            {
                IXmlLineInfoProvider = new XmlLineInfoProvider(xmlLineInfo);
            }

            IValueConverterProvider = new ValueConverterProvider();
        }