/// <summary> 
        /// Write Property Array Start
        /// </summary> 
        public override void WritePropertyArrayStart(XamlPropertyArrayStartNode xamlPropertyArrayStartNode)
        {
            if (_styleModeStack.Mode == StyleMode.VisualTree)
            { 
                _visualTreeComplexPropertyDepth++;
            } 
            else if (_styleModeStack.Mode == StyleMode.TriggerBase) 
            {
                _triggerComplexPropertyDepth++; 
            }

            base.WritePropertyArrayStart(xamlPropertyArrayStartNode);
            _styleModeStack.Push(); 
        }
Beispiel #2
0
 /// <summary>
 /// Write Property Array Start
 /// </summary>
 public virtual void WritePropertyArrayStart(XamlPropertyArrayStartNode xamlPropertyArrayStartNode)
 {
     if (BamlRecordWriter != null)
     {
         BamlRecordWriter.WritePropertyArrayStart(xamlPropertyArrayStartNode);
     }
 }
        // Write the start of an array property
        internal void WritePropertyArrayStart(
            XamlPropertyArrayStartNode xamlPropertyArrayStartNode)
        {
            // initialize the element and add to the stack
            BamlPropertyArrayStartRecord bamlPropertyArrayStart =
                (BamlPropertyArrayStartRecord) BamlRecordManager.GetWriteRecord(BamlRecordType.PropertyArrayStart);

            bamlPropertyArrayStart.AttributeId =
                MapTable.AddAttributeInfoMap(BinaryWriter,
                                             xamlPropertyArrayStartNode.AssemblyName,
                                             xamlPropertyArrayStartNode.TypeFullName,
                                             xamlPropertyArrayStartNode.PropDeclaringType,
                                             xamlPropertyArrayStartNode.PropName,
                                             null,
                                             BamlAttributeUsage.Default);

            WriteAndReleaseRecord(bamlPropertyArrayStart, xamlPropertyArrayStartNode);
        }
Beispiel #4
0
        /// <summary>
        /// Create nodes for a complex property that surrounds an element tree.
        /// Note that this is for general properties and not def attributes.
        /// </summary>
        internal void CompileAttribute(
            ArrayList xamlNodes,
            AttributeData data)
        {
            // For MarkupExtension syntax, treat PropertyInfo as a CLR property, but MethodInfo
            // and DependencyProperty as a DependencyProperty.  Note that the MarkupCompiler
            // will handle the case where a DependencyProperty callback is made if it gets
            // a MethodInfo for the attached property setter.
            string declaringTypeAssemblyName = data.DeclaringType.Assembly.FullName;
            string declaringTypeFullName = data.DeclaringType.FullName;

            // Find the PropertyRecordType to use in this case

            Type propertyType;
            bool propertyCanWrite;
            XamlTypeMapper.GetPropertyType(data.Info, out propertyType, out propertyCanWrite);
            BamlRecordType propertyRecordType = BamlRecordManager.GetPropertyStartRecordType(propertyType, propertyCanWrite);

            // Create the property start and end records

            XamlNode propertyStart;
            XamlNode propertyEnd;

            switch (propertyRecordType)
            {
                case BamlRecordType.PropertyArrayStart:
                {
                    propertyStart = new XamlPropertyArrayStartNode(
                                                                data.LineNumber,
                                                                data.LinePosition,
                                                                data.Depth,
                                                                data.Info,
                                                                declaringTypeAssemblyName,
                                                                declaringTypeFullName,
                                                                data.PropertyName);

                    propertyEnd = new XamlPropertyArrayEndNode(
                                          data.LineNumber,
                                          data.LinePosition,
                                          data.Depth);
                    break;
                }
                case BamlRecordType.PropertyIDictionaryStart:
                {
                    propertyStart = new XamlPropertyIDictionaryStartNode(
                                                                data.LineNumber,
                                                                data.LinePosition,
                                                                data.Depth,
                                                                data.Info,
                                                                declaringTypeAssemblyName,
                                                                declaringTypeFullName,
                                                                data.PropertyName);
                    propertyEnd = new XamlPropertyIDictionaryEndNode(
                                          data.LineNumber,
                                          data.LinePosition,
                                          data.Depth);
                    break;
                }
                case BamlRecordType.PropertyIListStart:
                {
                    propertyStart = new XamlPropertyIListStartNode(
                                                                data.LineNumber,
                                                                data.LinePosition,
                                                                data.Depth,
                                                                data.Info,
                                                                declaringTypeAssemblyName,
                                                                declaringTypeFullName,
                                                                data.PropertyName);
                    propertyEnd = new XamlPropertyIListEndNode(
                                          data.LineNumber,
                                          data.LinePosition,
                                          data.Depth);
                    break;
                }
                default: // PropertyComplexStart
                {
                    propertyStart = new XamlPropertyComplexStartNode(
                                                                data.LineNumber,
                                                                data.LinePosition,
                                                                data.Depth,
                                                                data.Info,
                                                                declaringTypeAssemblyName,
                                                                declaringTypeFullName,
                                                                data.PropertyName);
                    propertyEnd = new XamlPropertyComplexEndNode(
                                          data.LineNumber,
                                          data.LinePosition,
                                          data.Depth);
                    break;
                }
            }

            // NOTE:  Add duplicate property checking here as is done in XamlReaderHelper
            xamlNodes.Add(propertyStart);

            CompileAttributeCore(xamlNodes, data);

            xamlNodes.Add(propertyEnd);
        }
Beispiel #5
0
 /// <summary> 
 /// Write Property Array Start
 /// </summary>
 public override void WritePropertyArrayStart(XamlPropertyArrayStartNode xamlPropertyArrayStartNode)
 { 
     base.WritePropertyArrayStart(xamlPropertyArrayStartNode);
     _styleModeStack.Push(); 
 }