/// <summary> /// Initializes a new instance of the <see cref="SvgElement"/> class. /// </summary> public SvgElement() { this._children = new SvgElementCollection(this); //this._eventHandlers = new EventHandlerList(); this._elementName = string.Empty; this._customAttributes = new SvgCustomAttributeCollection(this); Transforms = new SvgTransformCollection(); //subscribe to attribute events Attributes.AttributeChanged += Attributes_AttributeChanged; CustomAttributes.AttributeChanged += Attributes_AttributeChanged; var typeInfo = this.GetType().GetTypeInfo(); ////find svg attribute descriptions _svgPropertyAttributes = from PropertyInfo a in typeInfo.DeclaredProperties let attribute = a.GetCustomAttribute <SvgAttributeAttribute>() where attribute != null select new PropertyAttributeTuple(a, attribute); _svgEventAttributes = from EventInfo a in typeInfo.DeclaredEvents let attribute = a.GetCustomAttribute <SvgAttributeAttribute>() where attribute != null select new EventAttributeTuple { Event = a, Attribute = attribute }; }
/// <summary> /// Initializes a new instance of the <see cref="SvgElement"/> class. /// </summary> public SvgElement() { this._children = new SvgElementCollection(this); this._eventHandlers = new EventHandlerList(); this._elementName = string.Empty; this._customAttributes = new SvgCustomAttributeCollection(this); Transforms = new SvgTransformCollection(); //subscribe to attribute events Attributes.AttributeChanged += Attributes_AttributeChanged; CustomAttributes.AttributeChanged += Attributes_AttributeChanged; //find svg attribute descriptions _svgPropertyAttributes = from PropertyDescriptor a in TypeDescriptor.GetProperties(this) let attribute = a.Attributes[typeof(SvgAttributeAttribute)] as SvgAttributeAttribute where attribute != null select new PropertyAttributeTuple { Property = a, Attribute = attribute }; _svgEventAttributes = from EventDescriptor a in TypeDescriptor.GetEvents(this) let attribute = a.Attributes[typeof(SvgAttributeAttribute)] as SvgAttributeAttribute where attribute != null select new EventAttributeTuple { Event = a.ComponentType.GetField(a.Name, BindingFlags.Instance | BindingFlags.NonPublic), Attribute = attribute }; }
/// <summary> /// Initializes a new instance of the <see cref="SvgElement"/> class. /// </summary> public SvgElement() { this._children = new SvgElementCollection(this); this._eventHandlers = new EventHandlerList(); this._elementName = string.Empty; this._customAttributes = new SvgCustomAttributeCollection(this); Transforms = new SvgTransformCollection(); //subscribe to attribute events Attributes.AttributeChanged += Attributes_AttributeChanged; CustomAttributes.AttributeChanged += Attributes_AttributeChanged; }