Table of Contents

Class SvgElementIdManager

Namespace
Svg
Assembly
Svg.dll

Provides methods to ensure element ID's are valid and unique.

public class SvgElementIdManager
Inheritance
SvgElementIdManager
Inherited Members

Constructors

SvgElementIdManager(SvgDocument)

Initialises a new instance of an SvgElementIdManager.

public SvgElementIdManager(SvgDocument document)

Parameters

document SvgDocument

The SvgDocument containing the SvgElements to manage.

Methods

Add(SvgElement)

Adds the specified SvgElement for ID management.

public virtual void Add(SvgElement element)

Parameters

element SvgElement

The SvgElement to be managed.

AddAndForceUniqueID(SvgElement, SvgElement, bool, Action<SvgElement, string, string>)

Adds the specified SvgElement for ID management. And can auto fix the ID if it already exists or it starts with a number.

public virtual bool AddAndForceUniqueID(SvgElement element, SvgElement sibling, bool autoForceUniqueID = true, Action<SvgElement, string, string> logElementOldIDNewID = null)

Parameters

element SvgElement

The SvgElement to be managed.

sibling SvgElement

Not used.

autoForceUniqueID bool

Pass true here, if you want the ID to be fixed

logElementOldIDNewID Action<SvgElement, string, string>

If not null, the action is called before the id is fixed

Returns

bool

true, if ID was altered

EnsureValidId(string, bool)

Ensures that the specified ID is unique within the containing SvgDocument.

public string EnsureValidId(string id, bool autoForceUniqueID = false)

Parameters

id string

A string containing the ID to validate.

autoForceUniqueID bool

Creates a new unique id string.

Returns

string

Exceptions

SvgException

An element with the same ID already exists within the containing SvgDocument.

GetElementById(string)

Retrieves the SvgElement with the specified ID.

public virtual SvgElement GetElementById(string id)

Parameters

id string

A string containing the ID of the element to find.

Returns

SvgElement

An SvgElement of one exists with the specified ID; otherwise false.

GetElementById(Uri)

public virtual SvgElement GetElementById(Uri uri)

Parameters

uri Uri

Returns

SvgElement

OnAdded(SvgElement)

protected void OnAdded(SvgElement element)

Parameters

element SvgElement

OnRemoved(SvgElement)

protected void OnRemoved(SvgElement element)

Parameters

element SvgElement

Remove(SvgElement)

Removed the specified SvgElement from ID management.

public virtual void Remove(SvgElement element)

Parameters

element SvgElement

The SvgElement to be removed from ID management.

Events

ElementAdded

public event EventHandler<SvgElementEventArgs> ElementAdded

Event Type

EventHandler<SvgElementEventArgs>

ElementRemoved

public event EventHandler<SvgElementEventArgs> ElementRemoved

Event Type

EventHandler<SvgElementEventArgs>