VegaRise.NET
HomeAPI Reference
Back to DOM

ElementClass

Definition

Namespace
DOM.Abstracts
Assembly
DOM.dll

Base DOM element implementation that participates in the parent/child tree.

Remarks

extends with the positional and parent-link behaviour required by elements that are placed inside a container: an index within the parent's children, a back-reference to the parent, and the insert / remove / replace operations that act on the parent's collection. Element BaseElement Most user-facing elements (paragraphs, tables, images) derive from which itself derives from this class. Elements that need to live in a container but do not contain children of their own can derive directly from . ParentElement Element

Examples

csharp
1// 1. Read the index of an element inside its parent
2int idx = paragraph.Index;
3
csharp
1// 2. Remove an element from its parent
2paragraph.Remove();
3
csharp
1// 3. Replace an element with another
2paragraph.Replace(new Paragraph());
3
csharp
1// 4. Insert siblings before or after the element
2paragraph.InsertAfter(new Paragraph());
3paragraph.InsertBefore(new Paragraph());
4
csharp
1// 5. Access the parent element
2var parent = paragraph.Parent;
3

Properties

Index

Gets the index of this element among its siblings of the same runtime type inside the parent's children collection.

Gets the parent element that contains this element.

Methods

Computes the index of this element among its siblings of the same runtime type.

Inserts the specified elements immediately after this element in the parent's child collection.

Inserts the specified elements immediately before this element in the parent's child collection.

Removes this element from its parent's child collection and marks it as deleted.

Replaces this element with at the same position in the parent's children collection. newChild