Example #1
0
        // Token: 0x06001F72 RID: 8050 RVA: 0x00094C1C File Offset: 0x00092E1C
        internal override void Copy(BamlRecord record)
        {
            base.Copy(record);
            BamlPropertyTypeReferenceRecord bamlPropertyTypeReferenceRecord = (BamlPropertyTypeReferenceRecord)record;

            bamlPropertyTypeReferenceRecord._typeId = this._typeId;
        }
Example #2
0
        // Read a Property record, get the current element off the context stack and a Type 
        // object from the TypeId in the property record.  This is the object to set
        // on the property. 
        protected virtual void ReadPropertyTypeRecord(BamlPropertyTypeReferenceRecord bamlPropertyRecord)
        {
            if (null == CurrentContext ||
                (ReaderFlags.DependencyObject != CurrentContext.ContextType && 
                 ReaderFlags.ClrObject != CurrentContext.ContextType))
            { 
                ThrowException(SRID.ParserUnexpInBAML, "Property"); 
            }
 
            // Define attrbuteId
            short attributeId = bamlPropertyRecord.AttributeId;

            // Identify the target element 
            object element = GetCurrentObjectData();
 
            // Get value type 
            Type valueType = MapTable.GetTypeFromId(bamlPropertyRecord.TypeId);
 
            // Identify the property
            WpfPropertyDefinition propertyDefinition = new WpfPropertyDefinition(this, attributeId, element is DependencyObject);

#if !STRESS 
            try
            { 
#endif 
                if( !SetPropertyValue( element, propertyDefinition, valueType ))
                { 
                    ThrowException(SRID.ParserCantGetDPOrPi, GetPropertyNameFromAttributeId(attributeId));
                }
#if !STRESS
            } 
            catch (Exception e)
            { 
                if (CriticalExceptions.IsCriticalException(e) || e is XamlParseException) 
                {
                    throw; 
                }

                TargetInvocationException tie = e as TargetInvocationException;
                if( tie != null ) 
                {
                    e = tie.InnerException; 
                } 

                ThrowExceptionWithLine(SR.Get(SRID.ParserCannotSetValue, element.GetType().FullName, propertyDefinition.Name, valueType.Name), e); 
            }
#endif
        }