internal void AddProperty(Int16 propertyId, Int16 declaringTypeId, string propertyName) { if (propertyId < 0) { throw new ArgumentOutOfRangeException("propertyId"); } if (propertyName == null) { throw new ArgumentNullException("propertyName"); } lock (_syncObject) { if (propertyId == _bamlProperty.Count) { BamlProperty property = new BamlProperty(declaringTypeId, propertyName); _bamlProperty.Add(property); } else if (propertyId > _bamlProperty.Count) { throw new ArgumentOutOfRangeException("propertyId", SR.Get(SRID.PropertyIdOutOfSequence, propertyId)); } } // Duplicate IDs (propertyId < _bamlProperty.Count) are ignored }
private bool TryGetBamlProperty(Int16 propertyId, out BamlProperty bamlProperty, out XamlMember xamlMember) { lock (_syncObject) { if (propertyId >= 0 && propertyId < _bamlProperty.Count) { Object property = _bamlProperty[propertyId]; xamlMember = property as XamlMember; bamlProperty = property as BamlProperty; return(true); } } if (propertyId < 0) { if (_parentSchemaContext == System.Windows.Markup.XamlReader.BamlSharedSchemaContext) { xamlMember = System.Windows.Markup.XamlReader.BamlSharedSchemaContext.GetKnownBamlMember(propertyId); } else { Int16 typeId; string propertyName; KnownTypes.GetKnownProperty(propertyId, out typeId, out propertyName); xamlMember = GetXamlType(typeId).GetMember(propertyName); } bamlProperty = null; return(true); } xamlMember = null; bamlProperty = null; return(false); }
internal String GetPropertyName(Int16 propertyId, bool fullName) { BamlProperty bamlProperty = null; XamlMember xamlMember; // IsAttachable doesn't matter since we're only looking for the name if (TryGetBamlProperty(propertyId, out bamlProperty, out xamlMember)) { if (xamlMember != null) { return(xamlMember.Name); } return(bamlProperty.Name); } throw new KeyNotFoundException(); }
private bool TryGetBamlProperty(Int16 propertyId, out BamlProperty bamlProperty, out XamlMember xamlMember) { lock (_syncObject) { if (propertyId >= 0 && propertyId < _bamlProperty.Count) { Object property = _bamlProperty[propertyId]; xamlMember = property as XamlMember; bamlProperty = property as BamlProperty; return true; } } if (propertyId < 0) { if (_parentSchemaContext == System.Windows.Markup.XamlReader.BamlSharedSchemaContext) { xamlMember = System.Windows.Markup.XamlReader.BamlSharedSchemaContext.GetKnownBamlMember(propertyId); } else { Int16 typeId; string propertyName; KnownTypes.GetKnownProperty(propertyId, out typeId, out propertyName); xamlMember = GetXamlType(typeId).GetMember(propertyName); } bamlProperty = null; return true; } xamlMember = null; bamlProperty = null; return false; }
internal void AddProperty(Int16 propertyId, Int16 declaringTypeId, string propertyName) { if (propertyId < 0) { throw new ArgumentOutOfRangeException("propertyId"); } if (propertyName == null) { throw new ArgumentNullException("propertyName"); } lock (_syncObject) { if (propertyId == _bamlProperty.Count) { BamlProperty property = new BamlProperty(declaringTypeId, propertyName); _bamlProperty.Add(property); } else if (propertyId > _bamlProperty.Count) { throw new ArgumentOutOfRangeException("propertyId", SR.Get(SRID.PropertyIdOutOfSequence, propertyId)); } } // Duplicate IDs (propertyId < _bamlProperty.Count) are ignored }