Search Results for

    Show / Hide Table of Contents

    Class ParentElement

    Inheritance
    System.Object
    ContentElement
    ParentElement
    BaseGraphicContainer
    TextContainer
    Container
    Paragraph
    Run
    Slide
    Implements
    ICloneableElement
    IParentElement
    IContentElement
    Inherited Members
    ContentElement._Index
    ContentElement.Replace(IContentElement)
    ContentElement.GetIndex()
    ContentElement.CloneObject<T>(T)
    ContentElement.CaptureInitialValues()
    ContentElement.Index
    ContentElement.Parent
    ContentElement.Status
    Namespace: IronPPT.Models.Abstract
    Assembly: IronPPT.dll
    Syntax
    public abstract class ParentElement : ContentElement, ICloneableElement, IParentElement, IContentElement

    ParentElement holds and arranges the child content nested inside it. It is the base every container in the slide model inherits, the type that knows how to add, find, reorder, and remove the elements it contains. A developer works with the concrete containers that derive from it, Slide, Paragraph, Run, and Container among them, and uses the members below to build their content. It extends ContentElement, so a container is itself an element inside its own parent.

    Because the class is abstract, a container is created as one of its derived types and its children are managed through the inherited members. Code that edits a document tree often holds a container as IParentElement, the contract this class implements, so it can rearrange children without naming the exact container type.

    Children is the List<IContentElement> of contained elements. AddChild appends one or more children and InsertChildToIndex places them at a given position, while RemoveChildren, RemoveAllChildren, and the overridden Remove take elements out. GetChildByIndex<T> fetches a typed child by position and ExtractElements<T> pulls every child of a given type from the subtree, which is how a developer collects, say, every run in a paragraph. Clone copies the container and its content, and LogObjectTree returns a text view of the nested structure that is useful while debugging a layout. Build a container's content by adding children, then reorder or extract them through these calls rather than rebuilding the tree.

    void Fill(ParentElement container, params IContentElement[] children)
    {
        container.AddChild(children);
    }

    The add text how-to covers adding content to a slide, the slide element tutorial walks through the nested element model, and the ContentElement reference documents the element side of the same tree.

    Constructors

    ParentElement()

    Declaration
    protected ParentElement()

    ParentElement(IContentElement[])

    Declaration
    public ParentElement(params IContentElement[] children)
    Parameters
    Type Name Description
    IContentElement[] children

    Properties

    Children

    Declaration
    public List<IContentElement> Children { get; set; }
    Property Value
    Type Description
    System.Collections.Generic.List<IContentElement>

    Methods

    AddChild(IContentElement[])

    Declaration
    public virtual void AddChild(params IContentElement[] children)
    Parameters
    Type Name Description
    IContentElement[] children

    Clone()

    Declaration
    public override IContentElement Clone()
    Returns
    Type Description
    IContentElement
    Overrides
    ContentElement.Clone()

    CloneElement<T>(T)

    Declaration
    protected static T CloneElement<T>(T original)
        where T : ParentElement
    Parameters
    Type Name Description
    T original
    Returns
    Type Description
    T
    Type Parameters
    Name Description
    T

    ExtractElements<T>()

    Declaration
    public List<T> ExtractElements<T>()
        where T : IContentElement
    Returns
    Type Description
    System.Collections.Generic.List<T>
    Type Parameters
    Name Description
    T

    GetChildByIndex<T>(Int32)

    Declaration
    public IContentElement GetChildByIndex<T>(int index)
        where T : IContentElement
    Parameters
    Type Name Description
    System.Int32 index
    Returns
    Type Description
    IContentElement
    Type Parameters
    Name Description
    T

    InsertChildToIndex(Int32, IContentElement[])

    Declaration
    public void InsertChildToIndex(int index, params IContentElement[] children)
    Parameters
    Type Name Description
    System.Int32 index
    IContentElement[] children

    LogObjectTree()

    Declaration
    public string LogObjectTree()
    Returns
    Type Description
    System.String

    Remove()

    Declaration
    public override void Remove()
    Overrides
    ContentElement.Remove()

    RemoveAllChildren()

    Declaration
    public void RemoveAllChildren()

    RemoveChildren(IContentElement[])

    Declaration
    public void RemoveChildren(params IContentElement[] children)
    Parameters
    Type Name Description
    IContentElement[] children

    Implements

    ICloneableElement
    IParentElement
    IContentElement

    Inherited members

    _Index
    Replace(IContentElement)
    GetIndex()
    CloneObject<T>(T)
    CaptureInitialValues()
    Index
    Parent
    Status
    ☀
    ☾
    Downloads
    • Download with NuGet
    • Start for Free
    In This Article
    Back to top
    Install with NuGet