Table of Contents

Class SvgAttributeCollection

Namespace
Svg
Assembly
Svg.dll

A collection of Scalable Vector Attributes that can be inherited from the owner elements ancestors.

public sealed class SvgAttributeCollection : Dictionary<string, object>, IDictionary<string, object>, ICollection<KeyValuePair<string, object>>, IReadOnlyDictionary<string, object>, IReadOnlyCollection<KeyValuePair<string, object>>, IEnumerable<KeyValuePair<string, object>>, IDictionary, ICollection, IEnumerable, IDeserializationCallback, ISerializable
Inheritance
SvgAttributeCollection
Implements
Inherited Members

Constructors

SvgAttributeCollection(SvgElement)

Initialises a new instance of a SvgAttributeCollection with the given SvgElement as the owner.

public SvgAttributeCollection(SvgElement owner)

Parameters

owner SvgElement

The SvgElement owner of the collection.

Properties

this[string]

Gets the attribute with the specified name.

public object this[string attributeName] { get; set; }

Parameters

attributeName string

A string containing the attribute name.

Property Value

object

The attribute value associated with the specified name; If there is no attribute the parent's value will be inherited.

Methods

GetAttribute<TAttributeType>(string, TAttributeType)

Gets the attribute with the specified name.

public TAttributeType GetAttribute<TAttributeType>(string attributeName, TAttributeType defaultValue = default)

Parameters

attributeName string

A string containing the name of the attribute.

defaultValue TAttributeType

The value to return if a value hasn't already been specified.

Returns

TAttributeType

The attribute value if available; otherwise the default value of TAttributeType.

Type Parameters

TAttributeType

The type of the attribute value.

GetInheritedAttribute<TAttributeType>(string, bool, TAttributeType)

Gets the attribute with the specified name and inherits from ancestors if there is no attribute set.

public TAttributeType GetInheritedAttribute<TAttributeType>(string attributeName, bool inherited, TAttributeType defaultValue = default)

Parameters

attributeName string

A string containing the name of the attribute.

inherited bool

Used only if the attribute value is not available. If set to true, the inherited value is returned in this case, otherwise the default value.

defaultValue TAttributeType

The value to return if a value hasn't already been specified.

Returns

TAttributeType

The attribute value if available and not set to "inherit"; the ancestors value for the same attribute if it exists and if either the attribute value is set to "inherit", or inherited is true; the default value otherwise.

Type Parameters

TAttributeType

The type of the attribute value.

Events

AttributeChanged

Fired when an Atrribute has changed

public event EventHandler<AttributeEventArgs> AttributeChanged

Event Type

EventHandler<AttributeEventArgs>