In This Article

TreeNodeItemCollection Class

Stores a collection of tree node items.

public class TreeNodeItemCollection : ISelectedTreeItemCollection
Inheritance:
object object
Implements:
ISelectedTreeItemCollection

Constructors

TreeNodeItemCollection(bool)

Initializes an instance of the TreeNodeItemCollection class.

public TreeNodeItemCollection(bool useHashSet)
Parameter Type Description
useHashSet bool

Whether to use a hash set to handle ActiproSoftware.Windows.Controls.Grids.Primitives.TreeNodeItemCollection.Contains(ActiproSoftware.Windows.Controls.Grids.Primitives.TreeNode) checks faster. Only use for selection collections.

Properties

CanFilter

Gets whether this view supports filtering via the Filter property.

public bool CanFilter { get; }

Property Value

bool:

true if this view supports filtering via the Filter property; otherwise, false.

CanGroup

Gets whether this view supports grouping via the GroupDescriptions property.

public bool CanGroup { get; }

Property Value

bool:

true if this view supports grouping via the GroupDescriptions property; otherwise, false.

CanSort

Gets whether this view supports sorting via the SortDescriptions property.

public bool CanSort { get; }

Property Value

bool:

true if this view supports sorting via the SortDescriptions property; otherwise, false.

Count

Gets the count of items in the collection.

public int Count { get; }

Property Value

int:

The count of items in the collection.

Culture

Gets or sets the cultural info for any operations of the view that may differ by culture, such as sorting.

public CultureInfo Culture { get; set; }

Property Value

CultureInfo:

The cultural info for any operations of the view that may differ by culture, such as sorting.

CurrentItem

Gets the current item in the view.

public object CurrentItem { get; }

Property Value

object:

The current item in the view.

CurrentPosition

Gets the ordinal position of the CurrentItem within the view.

public int CurrentPosition { get; }

Property Value

int:

The ordinal position of the CurrentItem within the view.

Filter

Gets or sets a callback used to determine if an item is suitable for inclusion in the view.

public Predicate<object> Filter { get; set; }

Property Value

Predicate<object>:

A callback used to determine if an item is suitable for inclusion in the view.

GroupDescriptions

Gets the collection of System.ComponentModel.GroupDescription objects that describe how the items in the collection are grouped in the view.

public ObservableCollection<GroupDescription> GroupDescriptions { get; }

Property Value

ObservableCollection<GroupDescription>:

The collection of System.ComponentModel.GroupDescription objects that describe how the items in the collection are grouped in the view.

Groups

Gets the top-level groups.

public ReadOnlyObservableCollection<object> Groups { get; }

Property Value

ReadOnlyObservableCollection<object>:

The top-level groups.

IsCurrentAfterLast

Gets whether the CurrentItem of the view is beyond the end of the collection.

public bool IsCurrentAfterLast { get; }

Property Value

bool:

true if the CurrentItem of the view is beyond the end of the collection; otherwise, false.

IsCurrentBeforeFirst

Gets whether the CurrentItem of the view is beyond the beginning of the collection.

public bool IsCurrentBeforeFirst { get; }

Property Value

bool:

true if the CurrentItem of the view is beyond the beginning of the collection; otherwise, false.

IsEmpty

Gets whether the resulting view is empty.

public bool IsEmpty { get; }

Property Value

bool:

true if the resulting view is empty; otherwise, false.

IsReadOnly

Gets a value indicating whether the collection is read-only.

public bool IsReadOnly { get; }

Property Value

bool:

true if the collection is read-only; otherwise, false.

this[int]

Gets the item at the specified index.

public object this[int index] { get; set; }
Parameter Type Description
index int

The index of the item to return.

Property Value

object:

The item at the specified index.

SortDescriptions

Gets a collection of System.ComponentModel.SortDescription objects that describe how the items in the collection are sorted in the view.

public SortDescriptionCollection SortDescriptions { get; }

Property Value

SortDescriptionCollection:

A collection of System.ComponentModel.SortDescription objects that describe how the items in the collection are sorted in the view.

SourceCollection

Gets the underlying collection.

public IEnumerable SourceCollection { get; }

Property Value

IEnumerable:

The underlying collection.

Methods

Add(object)

Adds an item to the collection.

public void Add(object item)
Parameter Type Description
item object

The object to add to the collection.

Clear()

Removes all items from the collection.

public void Clear()

Contains(object)

Determines whether the collection contains a specific value.

public bool Contains(object item)
Parameter Type Description
item object

The object to locate in the collection.

Returns

bool:

true if item is found in the collection; otherwise, false.

CopyTo(object[], int)

Copies the entire collection to a compatible one-dimensional Array, starting at the specified index of the target array.

public void CopyTo(object[] array, int arrayIndex)
Parameter Type Description
array object[]

The one-dimensional Array that is the destination of the elements copied from the collection. The Array must have zero-based indexing.

arrayIndex int

The zero-based index in array at which copying begins.

DeferRefresh()

Enters a defer cycle that you can use to merge changes to the view and delay automatic refresh.

public IDisposable DeferRefresh()

Returns

IDisposable:

An IDisposable object that you can use to dispose of the calling object.

GetEnumerator()

Retrieves an IEnumerator object for the entire collection.

public IEnumerator<object> GetEnumerator()

Returns

IEnumerator<object>:

An IEnumerator object for the entire collection

Remarks

Enumerators are intended to be used only to read data in the collection. Enumerators cannot be used to modify the underlying collection.

The enumerator does not have exclusive access to the collection.

When an enumerator is instantiated, it takes a snapshot of the current state of the collection. If changes are made to the collection, such as adding, modifying or deleting elements, the snapshot gets out of sync and the enumerator throws an InvalidOperationException. Two enumerators instantiated from the same collection at the same time can have different snapshots of the collection.

IndexOf(object)

Determines the index of a specific item in the list.

public int IndexOf(object item)
Parameter Type Description
item object

The object to locate in the list.

Returns

int:

The index of item if found in the list; otherwise, -1.

Insert(int, object)

Inserts an item into the collection at the specified index.

public void Insert(int index, object item)
Parameter Type Description
index int

The zero-based index at which the item should be inserted.

item object

The item to insert.

Remarks

If index is equal to Count, value is added to the end of the collection.

MoveCurrentTo(object)

Sets the specified item to be the CurrentItem in the view.

public bool MoveCurrentTo(object item)
Parameter Type Description
item object

The item to set.

Returns

bool:

true if the resulting CurrentItem is within the view; otherwise, false.

MoveCurrentToFirst()

Sets the first item in the view as the CurrentItem.

public bool MoveCurrentToFirst()

Returns

bool:

true if the resulting CurrentItem is within the view; otherwise, false.

MoveCurrentToLast()

Sets the last item in the view as the CurrentItem.

public bool MoveCurrentToLast()

Returns

bool:

true if the resulting CurrentItem is within the view; otherwise, false.

MoveCurrentToNext()

Sets the item after the CurrentItem in the view as the CurrentItem.

public bool MoveCurrentToNext()

Returns

bool:

true if the resulting CurrentItem is within the view; otherwise, false.

MoveCurrentToPosition(int)

Sets the item at the specified index to be the CurrentItem in the view.

public bool MoveCurrentToPosition(int position)
Parameter Type Description
position int

The index to set the CurrentItem to.

Returns

bool:

true if the resulting CurrentItem is within the view; otherwise, false.

MoveCurrentToPrevious()

Sets the item before the CurrentItem in the view as the CurrentItem.

public bool MoveCurrentToPrevious()

Returns

bool:

true if the resulting CurrentItem is within the view; otherwise, false.

Refresh()

Recreates the view.

public void Refresh()

Remove(object)

Removes the specified item from the collection.

public bool Remove(object item)
Parameter Type Description
item object

The item to remove.

Returns

bool

RemoveAt(int)

Removes the item at the specified index of the collection.

public void RemoveAt(int index)
Parameter Type Description
index int

The zero-based index of the item to remove.

Events

CollectionChanged

Occurs when the collection is changed.

public event NotifyCollectionChangedEventHandler CollectionChanged

Event Type

NotifyCollectionChangedEventHandler

CurrentChanged

Occurs after the CurrentItem has changed.

public event EventHandler CurrentChanged

Event Type

EventHandler

CurrentChanging

Occurs after the CurrentItem has changed.

public event CurrentChangingEventHandler CurrentChanging

Event Type

CurrentChangingEventHandler

Inherited Members