コード例 #1
0
        /// <summary> 
        /// WriteEndAttributes occurs after the last attribute (property, complex property or 
        /// def record) is written.  Note that if there are none of the above, then WriteEndAttributes
        /// is not called for a normal start tag. 
        /// </summary>
        public override void WriteEndAttributes(XamlEndAttributesNode xamlEndAttributesNode)
        {
#if PBTCOMPILER 
            // reset the event scope so that a new tag may start a new scope for its own events
            if (_styleModeStack.Mode == StyleMode.VisualTree && !xamlEndAttributesNode.IsCompact) 
            { 
                _isSameScope = false;
            } 
#endif
            if (_styleModeStack.Mode == StyleMode.TriggerBase && !xamlEndAttributesNode.IsCompact)
            {
                MemberInfo dpInfo = null; 
                if (_setterOrTriggerPropertyNode != null)
                { 
                    dpInfo = GetDependencyPropertyInfo(_setterOrTriggerPropertyNode); 
                    base.WriteProperty(_setterOrTriggerPropertyNode);
                    _setterOrTriggerPropertyNode = null; 
                    _setterOrTriggerPropertyMemberInfo = dpInfo;
                }

                _setterTargetNameOrConditionSourceName = null; 

                if (_setterOrTriggerValueNode != null) 
                { 
                    ProcessPropertyValueNode();
                } 
            }

            base.WriteEndAttributes(xamlEndAttributesNode);
 
        }
コード例 #2
0
        /// <summary>
        /// override of WriteEndAttributes
        /// </summary>
        public override void WriteEndAttributes(XamlEndAttributesNode xamlEndAttributesNode)
        {
            if (xamlEndAttributesNode.IsCompact)
                return;

            if (_isRootTag)
            {
                _class = string.Empty;
                _classModifier = string.Empty;
                _subClass = string.Empty;
                XamlTypeMapper.IsProtectedAttributeAllowed = false;
            }

            _isRootTag = false;
            _isSameScope = false;

            if (!_pass2)
            {
                if (_nameField == null)
                {
                    if (_isFieldModifierSet)
                    {
                        ThrowException(SRID.FieldModifierNotAllowed,
                                       MarkupCompiler.DefinitionNSPrefix,
                                       xamlEndAttributesNode.LineNumber,
                                       xamlEndAttributesNode.LinePosition);
                    }
                }
                else if (_fieldModifier != MemberAttributes.Assembly)
                {
                    if (MemberAttributes.Private != _fieldModifier &&
                        MemberAttributes.Assembly != _fieldModifier)
                    {
                        MarkupCompiler.GenerateXmlComments(_nameField, _nameField.Name + " Name Field");
                    }

                    _nameField.Attributes = _fieldModifier;
                    _fieldModifier = MemberAttributes.Assembly;
                }

                _nameField = null;
                _isFieldModifierSet = false;

                _compiler.ConnectNameAndEvents(_name, _events, _connectionId);

                _name = null;

                if (_events != null)
                {
                    _events.Clear();
                    _events = null;
                }
            }
            else
            {
                _compiler.CheckForNestedNameScope();
            }

            base.WriteEndAttributes(xamlEndAttributesNode);
        }
コード例 #3
0
ファイル: ParserExtension.cs プロジェクト: ash2005/z
        /// <summary>
        /// override of WriteEndAttributes
        /// </summary>
        public override void WriteEndAttributes(XamlEndAttributesNode xamlEndAttributesNode)
        {
            if (xamlEndAttributesNode.IsCompact)
            {
                return;
            }

            if (_isRootTag)
            {
                _class         = string.Empty;
                _classModifier = string.Empty;
                _subClass      = string.Empty;
                XamlTypeMapper.IsProtectedAttributeAllowed = false;
            }

            _isRootTag   = false;
            _isSameScope = false;

            if (!_pass2)
            {
                if (_nameField == null)
                {
                    if (_isFieldModifierSet)
                    {
                        ThrowException(SRID.FieldModifierNotAllowed,
                                       MarkupCompiler.DefinitionNSPrefix,
                                       xamlEndAttributesNode.LineNumber,
                                       xamlEndAttributesNode.LinePosition);
                    }
                }
                else if (_fieldModifier != MemberAttributes.Assembly)
                {
                    if (MemberAttributes.Private != _fieldModifier &&
                        MemberAttributes.Assembly != _fieldModifier)
                    {
                        MarkupCompiler.GenerateXmlComments(_nameField, _nameField.Name + " Name Field");
                    }

                    _nameField.Attributes = _fieldModifier;
                    _fieldModifier        = MemberAttributes.Assembly;
                }

                _nameField          = null;
                _isFieldModifierSet = false;

                _compiler.ConnectNameAndEvents(_name, _events, _connectionId);

                _name = null;

                if (_events != null)
                {
                    _events.Clear();
                    _events = null;
                }
            }
            else
            {
                _compiler.CheckForNestedNameScope();
            }

            base.WriteEndAttributes(xamlEndAttributesNode);
        }
コード例 #4
0
ファイル: XamlParser.cs プロジェクト: JianwenSun/cc
 /// <summary>
 /// WriteEndAttributes occurs after the last attribute (property, complex property or
 /// def record) is written.  Note that if there are none of the above, then WriteEndAttributes
 /// is not called for a normal start tag.
 /// </summary>
 public virtual void WriteEndAttributes(XamlEndAttributesNode xamlEndAttributesNode)
 {
     if (BamlRecordWriter != null)
     {
         BamlRecordWriter.WriteEndAttributes(xamlEndAttributesNode);
     }
 }
コード例 #5
0
 // The end of the start tag has been reached.  For compile cases, check
 // if we are accumulating a deferable block of records.
 internal void WriteEndAttributes(XamlEndAttributesNode xamlEndAttributesNode)
 {
     if (_deferLoadingSupport && _deferElementDepth > 0)
     {
         _deferEndOfStartReached = true;
     }
 }
コード例 #6
0
        /// <summary>
        /// override of WriteEndAttributes
        /// </summary>
        public override void WriteEndAttributes(XamlEndAttributesNode xamlEndAttributesNode)
        {
            if (xamlEndAttributesNode.IsCompact)
            {
                return;
            }

            if (_isRootTag)
            {
                _class         = string.Empty;
                _classModifier = string.Empty;
                _subClass      = string.Empty;
                XamlTypeMapper.IsProtectedAttributeAllowed = false;
            }

            _isRootTag   = false;
            _isSameScope = false;

            if (!_pass2)
            {
                if (_nameField == null)
                {
                    if (_isFieldModifierSet)
                    {
                        ThrowException(SRID.FieldModifierNotAllowed,
                                       MarkupCompiler.DefinitionNSPrefix,
                                       xamlEndAttributesNode.LineNumber,
                                       xamlEndAttributesNode.LinePosition);
                    }
                }
                else if (_fieldModifier != MemberAttributes.Assembly)
                {
                    if (MemberAttributes.Private != _fieldModifier &&
                        MemberAttributes.Assembly != _fieldModifier)
                    {
                        MarkupCompiler.GenerateXmlComments(_nameField, _nameField.Name + " Name Field");
                    }

                    _nameField.Attributes = _fieldModifier;
                    _fieldModifier        = MemberAttributes.Assembly;
                }

                _nameField          = null;
                _isFieldModifierSet = false;

                _compiler.ConnectNameAndEvents(_name, _events, _connectionId);

                _name = null;

                if (_events != null)
                {
                    _events.Clear();
                    _events = null;
                }
            }
            else
            {
                _compiler.CheckForNestedNameScope();
            }

            // Clear the compiler's generic type argument list
            // (Strange xaml compilation error MC6025 in unrelated class)
            // The bug arises because the markup compiler's _typeArgsList is set for any tag
            // that has an x:TypeArguments attribute.   It should be cleared upon reaching the
            // end of the tag's attributes, but this only happens in the non-pass2 case.  If the
            // tag needs pass2 processing, the list is set but not cleared, leading to a mysterious
            // exception in the next tag (<ResourceDictionary>, in the repro).
            _compiler.ClearGenericTypeArgs();

            base.WriteEndAttributes(xamlEndAttributesNode);
        }
コード例 #7
0
ファイル: StyleXamlParser.cs プロジェクト: sjyanxin/WPFSource
        private void ProcessEventSetterNode(XamlEndAttributesNode xamlEndAttributesNode) 
        {
            // Check for EventSetter properties. These aren't really stored as properties but 
            // resolved at the EventSetter end tag as events by the compiler 
            Debug.Assert(_inEventSetter);
 
            string member = _event;
            MemberInfo memberInfo = GetPropertyOrEventInfo(xamlEndAttributesNode, ref member);
            // If we have an event setter on a locally defined component, write it out
            // as a property instead of an event so that it will be resolved at runtime. 
            if (null != memberInfo)
            { 
                XamlClrEventNode eventNode = new XamlClrEventNode( 
                    xamlEndAttributesNode.LineNumber,
                    xamlEndAttributesNode.LinePosition, 
                    xamlEndAttributesNode.Depth,
                    member,
                    memberInfo,
                    _handler); 
#if HANDLEDEVENTSTOO
                eventNode.HandledEventsToo = _handledEventsToo; 
#endif 
                WriteClrEvent(eventNode);
            } 

            _event = null;
            _handler = null;
#if HANDLEDEVENTSTOO 
            _handledEventsToo = false;
#endif 
        } 
コード例 #8
0
ファイル: StyleXamlParser.cs プロジェクト: sjyanxin/WPFSource
        /// <summary> 
        /// WriteEndAttributes occurs after the last attribute (property, complex property or 
        /// def record) is written.  Note that if there are none of the above, then WriteEndAttributes
        /// is not called for a normal start tag. 
        /// </summary>
        public override void WriteEndAttributes(XamlEndAttributesNode xamlEndAttributesNode)
        {
            if ((_styleModeStack.Mode == StyleMode.Setters || _styleModeStack.Mode == StyleMode.TriggerBase) && 
                !xamlEndAttributesNode.IsCompact)
            { 
                if (_setterOrTriggerValueNode != null) 
                {
                    ProcessPropertyValueNode(); 
                }
#if PBTCOMPILER
                else if (_inEventSetter)
                { 
                    ProcessEventSetterNode(xamlEndAttributesNode);
                } 
#endif 
            }
 
            base.WriteEndAttributes(xamlEndAttributesNode);
        }