public XamlProperty ResolveProperty(ushort id) { if (propertyMap.TryGetValue(id, out var xamlProp)) { return(xamlProp); } XamlType type; string name; IMember member; if (id > 0x7fff) { var knownProp = Baml.KnownThings.Members((KnownMembers) unchecked ((short)-(short)id)); type = ResolveType(unchecked ((ushort)(short)-(short)knownProp.Parent)); name = knownProp.Name; member = knownProp.Property; } else { var attrRec = Baml.AttributeIdMap[id]; type = ResolveType(attrRec.OwnerTypeId); name = attrRec.Name; member = null; } propertyMap[id] = xamlProp = new XamlProperty(type, name) { ResolvedMember = member }; xamlProp.TryResolve(); return(xamlProp); }
public XamlModelProperty(XamlDesignItem designItem, XamlProperty property) { Debug.Assert(designItem != null); Debug.Assert(property != null); this._designItem = designItem; this._property = property; if (property.IsCollection) { _collectionElements = new XamlModelCollectionElementsCollection(this, property); } }
static bool NeedsFullName(XamlProperty property, XElement elem) { var p = elem.Parent; while (p != null && p.Annotation <XamlType>()?.ResolvedType.FullName != "System.Windows.Style") { p = p.Parent; } var type = p?.Annotation <TargetTypeAnnotation>()?.Type; return(type == null || property.IsAttachedTo(type)); }
public override XamlProperty GetDirectiveProperty(string name) { if (_directives == null) { _directives = LoadDirectives(); } XamlProperty directive = _directives.GetDirectiveProperty(name); if (directive == null) { directive = new UnknownProperty(name, null, /*declaringType - xml directives don't have one. */ XmlDirectives.Uri); } return(directive); }
private bool NeedsFullName(XamlProperty property, XamlContext ctx, XElement elem) { XElement p = elem.Parent; while (p != null && p.Annotation <XamlType>()?.ResolvedType.FullName != "System.Windows.Style") { p = p.Parent; } var type = p?.Annotation <TargetTypeAnnotation>()?.Type; if (type == null) { return(true); } return(property.IsAttachedTo(type)); }
public XamlModelProperty(XamlDesignItem designItem, XamlProperty property) { Debug.Assert(designItem != null); Debug.Assert(property != null); this._designItem = designItem; this._property = property; if (property.IsCollection) { _collectionElements = new XamlModelCollectionElementsCollection(this, property); } ValueChanged += (x, y) => { OnPropertyChanged("Value"); OnPropertyChanged("ValueOnInstanceOrView"); }; ValueOnInstanceChanged += (x, y) => { OnPropertyChanged("ValueOnInstance"); OnPropertyChanged("ValueOnInstanceOrView"); }; }
private XamlProperty LookupDependsOn() { object obj = LookupCustomAttribute(typeof(DependsOnAttribute)); if (obj == null) { return(null); } else { string doPropertyName = ((DependsOnAttribute)obj).Name; XamlProperty xp = _declaringType.GetProperty(doPropertyName); if (xp != null) { return(xp); } else { string err = SR.Get(SRID.UnknownAttributeProperty, typeof(DependsOnAttribute).Name, doPropertyName, _name); throw new XamlSchemaException(err); } } }
set => SetValue(XamlProperty, value);
public XamlModelCollectionElementsCollection(XamlModelProperty modelProperty, XamlProperty property) { this.modelProperty = modelProperty; this.property = property; this.context = (XamlDesignContext)modelProperty.DesignItem.Context; }