コード例 #1
0
ファイル: ParserExtension.cs プロジェクト: dox0/DotNet471RS3
        public override void WriteUnknownTagStart(XamlUnknownTagStartNode xamlUnknownTagStartNode)
        {
            string localElementFullName = string.Empty;

            NamespaceMapEntry[] namespaceMaps = XamlTypeMapper.GetNamespaceMapEntries(xamlUnknownTagStartNode.XmlNamespace);

            if (namespaceMaps != null && namespaceMaps.Length == 1 && namespaceMaps[0].LocalAssembly)
            {
                string ns = namespaceMaps[0].ClrNamespace;
                if (!string.IsNullOrEmpty(ns))
                {
                    ns += MarkupCompiler.DOT;
                }
                localElementFullName = ns + xamlUnknownTagStartNode.Value;
            }

            if (localElementFullName.Length > 0 && !_pass2)
            {
                // if local complex property bail out now and handle in 2nd pass when TypInfo is available
                int lastIndex = xamlUnknownTagStartNode.Value.LastIndexOf(MarkupCompiler.DOTCHAR);
                if (-1 == lastIndex)
                {
                    _compiler.StartElement(ref _class,
                                           _subClass,
                                           ref _classModifier,
                                           null,
                                           localElementFullName);
                }
            }
            else
            {
                base.WriteUnknownTagStart(xamlUnknownTagStartNode);
            }
        }
コード例 #2
0
        /// <summary> 
        /// Write start of an unknown tag
        /// </summary>
        /// <remarks>
        /// For template parsing, the 'Set' tag is an unknown tag, but this will map to a 
        /// Trigger set command.  Store this as an element start record here.
        /// Also 'Set.Value' will map to the a complex Value set portion of the Set command. 
        /// </remarks> 
        public override void WriteUnknownTagStart(XamlUnknownTagStartNode xamlUnknownTagStartNode)
        { 
            StyleMode mode = _styleModeStack.Mode;

            // Keep mode and other state up-to-date.  This
            // must be called before updating stack. 

             CommonElementStartProcessing(xamlUnknownTagStartNode, null, ref mode); 
            _styleModeStack.Push(mode); 

 
#if PBTCOMPILER
            string localElementFullName = string.Empty;
            int lastIndex = xamlUnknownTagStartNode.Value.LastIndexOf('.');
 
            // if local complex property bail out now and handle in 2nd pass when TypInfo is available
            if (-1 == lastIndex) 
            { 
                NamespaceMapEntry[] namespaceMaps = XamlTypeMapper.GetNamespaceMapEntries(xamlUnknownTagStartNode.XmlNamespace);
 
                if (namespaceMaps != null && namespaceMaps.Length == 1 && namespaceMaps[0].LocalAssembly)
                {
                    localElementFullName = namespaceMaps[0].ClrNamespace + "." + xamlUnknownTagStartNode.Value;
                } 
            }
            else if (IsLocalPass1) 
            { 
                return;
            } 

            if (localElementFullName.Length == 0 || !IsLocalPass1)
            {
#endif 
                // It can be a fairly common error for,
                // <ControlTemplate.Triggers>, <DataTemplate.Triggers>, or <TableTemplate.Triggers> 
                // to be specified at the wrong nesting level (See Windows bug 966137).  Detect 
                // these cases to give more meaningful error messages.
                if (xamlUnknownTagStartNode.Value == XamlTemplateSerializer.ControlTemplateTriggersFullPropertyName || 
                    xamlUnknownTagStartNode.Value == XamlTemplateSerializer.DataTemplateTriggersFullPropertyName ||
                    xamlUnknownTagStartNode.Value == XamlTemplateSerializer.HierarchicalDataTemplateTriggersFullPropertyName ||
                    xamlUnknownTagStartNode.Value == XamlTemplateSerializer.HierarchicalDataTemplateItemsSourceFullPropertyName ||
                    xamlUnknownTagStartNode.Value == XamlTemplateSerializer.HierarchicalDataTemplateItemTemplateFullPropertyName || 
                    xamlUnknownTagStartNode.Value == XamlTemplateSerializer.HierarchicalDataTemplateItemTemplateSelectorFullPropertyName ||
                    xamlUnknownTagStartNode.Value == XamlTemplateSerializer.HierarchicalDataTemplateItemContainerStyleFullPropertyName || 
                    xamlUnknownTagStartNode.Value == XamlTemplateSerializer.HierarchicalDataTemplateItemContainerStyleSelectorFullPropertyName || 
                    xamlUnknownTagStartNode.Value == XamlTemplateSerializer.HierarchicalDataTemplateItemStringFormatFullPropertyName ||
                    xamlUnknownTagStartNode.Value == XamlTemplateSerializer.HierarchicalDataTemplateItemBindingGroupFullPropertyName || 
                    xamlUnknownTagStartNode.Value == XamlTemplateSerializer.HierarchicalDataTemplateAlternationCountFullPropertyName
                    )
                {
                    ThrowException(SRID.TemplateKnownTagWrongLocation, 
                                   xamlUnknownTagStartNode.Value,
                                   xamlUnknownTagStartNode.LineNumber, 
                                   xamlUnknownTagStartNode.LinePosition); 
                }
                else 
                {
                    base.WriteUnknownTagStart(xamlUnknownTagStartNode);
                }
#if PBTCOMPILER 
            }
#endif 
 
         }
コード例 #3
0
ファイル: XamlParser.cs プロジェクト: JianwenSun/cc
 /// <summary>
 /// Write start of an unknown tag
 /// </summary>
 public virtual void WriteUnknownTagStart(XamlUnknownTagStartNode xamlUnknownTagStartNode)
 {
     // The default action for unknown tags is throw an exception.
     ThrowException(SRID.ParserUnknownTag ,
                 xamlUnknownTagStartNode.Value,
                 xamlUnknownTagStartNode.XmlNamespace,
                 xamlUnknownTagStartNode.LineNumber,
                 xamlUnknownTagStartNode.LinePosition);
 }
コード例 #4
0
        public override void WriteUnknownTagStart(XamlUnknownTagStartNode xamlUnknownTagStartNode)
        {
            string localElementFullName = string.Empty;
            NamespaceMapEntry[] namespaceMaps = XamlTypeMapper.GetNamespaceMapEntries(xamlUnknownTagStartNode.XmlNamespace);

            if (namespaceMaps != null && namespaceMaps.Length == 1 && namespaceMaps[0].LocalAssembly)
            {
                string ns = namespaceMaps[0].ClrNamespace;
                if (!string.IsNullOrEmpty(ns))
                {
                    ns += MarkupCompiler.DOT;
                }
                localElementFullName =  ns + xamlUnknownTagStartNode.Value;
            }

            if (localElementFullName.Length > 0 && !_pass2)
            {
                // if local complex property bail out now and handle in 2nd pass when TypInfo is available
                int lastIndex = xamlUnknownTagStartNode.Value.LastIndexOf(MarkupCompiler.DOTCHAR);
                if (-1 == lastIndex)
                {
                    _compiler.StartElement(ref _class,
                                           _subClass,
                                           ref _classModifier,
                                           null,
                                           localElementFullName);
                }
            }
            else
            {
                base.WriteUnknownTagStart(xamlUnknownTagStartNode);
            }
        }
コード例 #5
0
ファイル: StyleXamlParser.cs プロジェクト: sjyanxin/WPFSource
        /// <summary> 
        /// Write start of an unknown tag
        /// </summary> 
        /// <remarks> 
        /// For style parsing, the 'Set' tag is an unknown tag, but this will map to a
        /// Trigger set command.  Store this as an element start record here. 
        /// Also 'Set.Value' will map to the a complex Value set portion of the Set command.
        /// </remarks>
        public override void WriteUnknownTagStart(XamlUnknownTagStartNode xamlUnknownTagStartNode)
        { 
#if PBTCOMPILER
            string localElementFullName = string.Empty; 
            int lastIndex = xamlUnknownTagStartNode.Value.LastIndexOf('.'); 

            // if local complex property bail out now and handle in 2nd pass when TypeInfo is available 
            if (-1 == lastIndex)
            {
                NamespaceMapEntry[] namespaceMaps = XamlTypeMapper.GetNamespaceMapEntries(xamlUnknownTagStartNode.XmlNamespace);
 
                if (namespaceMaps != null && namespaceMaps.Length == 1 && namespaceMaps[0].LocalAssembly)
                { 
                    localElementFullName = namespaceMaps[0].ClrNamespace + "." + xamlUnknownTagStartNode.Value; 
                }
            } 
            else if (IsLocalPass1)
            {
                return;
            } 

            if (localElementFullName.Length == 0 || !IsLocalPass1) 
            { 
#endif
                // It can be a fairly common error for <Style.Setters>, 
                // or <Style.Triggers> to be specified
                // at the wrong nesting level (See Windows bug 966137).  Detect
                // these cases to give more meaningful error messages.
                if (xamlUnknownTagStartNode.Value == XamlStyleSerializer.VisualTriggersFullPropertyName || 
                    xamlUnknownTagStartNode.Value == XamlStyleSerializer.SettersFullPropertyName)
                { 
                    ThrowException(SRID.StyleKnownTagWrongLocation, 
                                   xamlUnknownTagStartNode.Value,
                                   xamlUnknownTagStartNode.LineNumber, 
                                   xamlUnknownTagStartNode.LinePosition);
                }
                else
                { 
                    base.WriteUnknownTagStart(xamlUnknownTagStartNode);
                } 
#if PBTCOMPILER 
            }
#endif 
        }