Exemplo n.º 1
0
        /// <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
            };
        }
Exemplo n.º 2
0
        /// <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
            };
        }
Exemplo n.º 3
0
        /// <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;
        }
Exemplo n.º 4
0
        /// <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 Dictionary <string, string>();

            //fill svg attribute description
            _svgAttributes = from PropertyDescriptor a in TypeDescriptor.GetProperties(this)
                             let attribute = a.Attributes[typeof(SvgAttributeAttribute)] as SvgAttributeAttribute
                                             where attribute != null
                                             select new AttributeTuple {
                Property = a, Attribute = attribute
            };
        }
Exemplo n.º 5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SvgElement"/> class.
 /// </summary>
 internal SvgElement()
 {
     this._children      = new SvgElementCollection(this);
     this._eventHandlers = new EventHandlerList();
     this._elementName   = string.Empty;
 }
Exemplo n.º 6
0
 public SvgGroup(SvgElementCollection container)
 {
     container.Add(this);
 }