Table of Contents

Class TreeItem

Namespace
Ranorex
Assembly
Ranorex.Core.dll

Represents an item in a tree.

public class TreeItem : Adapter, IAdapter
Inheritance
TreeItem
Implements
Inherited Members

Constructors

TreeItem()

Creates a new TreeItem adapter instance. This constructor is used internally by the Ranorex Core Framework for performance issues!

protected TreeItem()

TreeItem(Element)

Creates a new TreeItem adapter instance.

public TreeItem(Element element)

Parameters

element Element

The element to create the adapter for.

Exceptions

NullReferenceException

If element is null.

CapabilityNotSupportedException

If the element does not support the capabilities required by this adapter.

Properties

Checked

True if the tree item is checked.

public virtual bool Checked { get; set; }

Property Value

bool

Exceptions

SetAttributeFailedException

Thrown if setting the attribute value failed.

DescendantItems

Gets all tree items contained in this subtree as a list.

public IList<TreeItem> DescendantItems { get; }

Property Value

IList<TreeItem>

The descendant tree items.

Expanded

True if the tree item is expanded.

public virtual bool Expanded { get; set; }

Property Value

bool

Exceptions

SetAttributeFailedException

Thrown if setting the attribute value failed.

Image

The image or icon associated with the tree item.

public virtual Image Image { get; }

Property Value

Image

this[string]

Gets the TreeItem with the specified item label.

public TreeItem this[string itemLabel] { get; }

Parameters

itemLabel string

Property Value

TreeItem

The list item.

Exceptions

ElementNotFoundException

If no item with that label is found.

Items

Gets the tree items which are immediate children of this tree item.

public IList<TreeItem> Items { get; }

Property Value

IList<TreeItem>

The tree items.

RequiredCapabilities

Capabilities required by the adapter implementation.

protected override string[] RequiredCapabilities { get; }

Property Value

string[]

Selected

True if the tree item is selected.

public virtual bool Selected { get; set; }

Property Value

bool

Exceptions

SetAttributeFailedException

Thrown if setting the attribute value failed.

SelectedDescendantItems

Gets all selected tree items contained in this subtree as a list.

public IList<TreeItem> SelectedDescendantItems { get; }

Property Value

IList<TreeItem>

The selected descendant tree items.

SelectedItems

Gets the selected tree items which are immediate children of this tree item.

public IList<TreeItem> SelectedItems { get; }

Property Value

IList<TreeItem>

The tree items.

Text

The text of the tree item.

public virtual string Text { get; }

Property Value

string

Methods

Collapse()

Collapses the tree item, hiding its children.

public void Collapse()

CollapseAll()

Collapses the tree item and all its children, recursively.

public void CollapseAll()

Expand()

Expands the tree item, making its children visible.

public void Expand()

ExpandAll()

Expands the tree item and all its children, recursively.

public void ExpandAll()

FromElement(Element)

Converts an Element to an instance of this class.

public static TreeItem FromElement(Element element)

Parameters

element Element

The element to convert.

Returns

TreeItem

The TreeItem.

Exceptions

ArgumentNullException

If element is null.

CapabilityNotSupportedException

If the element does not support the capabilities required by this adapter.

FromPath(string)

Converts a string to an instance of this class by searching the root.

public static TreeItem FromPath(string path)

Parameters

path string

The search path.

Returns

TreeItem

The TreeItem.

Remarks

The DefaultSearchTimeout is used to search for the specified path.

Exceptions

ArgumentNullException

If path is null.

RxPathException

If the specified path is not valid.

ElementNotFoundException

If no element is found.

CapabilityNotSupportedException

If the element does not support the capabilities required by this adapter.

Select()

Selects the item.

public virtual void Select()

Exceptions

ActionFailedException

Thrown if invoking the action failed.

Operators

implicit operator TreeItem(Element)

Implicitly converts an Element to an instance of this class.

public static implicit operator TreeItem(Element element)

Parameters

element Element

The element to convert.

Returns

TreeItem

The TreeItem.

Exceptions

ArgumentNullException

If element is null.

CapabilityNotSupportedException

If the element does not support the capabilities required by this adapter.

implicit operator TreeItem(string)

Implicitly converts a string to an instance of this class by searching the root.

public static implicit operator TreeItem(string path)

Parameters

path string

The search path.

Returns

TreeItem

The TreeItem.

Remarks

The DefaultSearchTimeout is used to search for the specified path.

Exceptions

ArgumentNullException

If path is null.

RxPathException

If the specified path is not valid.

ElementNotFoundException

If no element is found.

CapabilityNotSupportedException

If the element does not support the capabilities required by this adapter.