In This Article

BarCommandLinkCollection Class

Represents a collection of BarCommandLink objects.

public class BarCommandLinkCollection : UIElementCollection, IDisposable
Inheritance:
object MarshalByRefObject MarshalByRefDisposableObject LogicalTreeNodeCollection UIElementCollection object
Implements:
IDisposable

Properties

this[int]

The item at the specified index.

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

The index of the item to return.

Property Value

BarCommandLink

this[string]

The first BarCommandLink in the collection that is based on a BarCommand with the specified FullName.

public BarCommandLink? this[string commandFullName] { get; }
Parameter Type Description
commandFullName string

The FullName to locate in the collection.

Property Value

BarCommandLink

SingularElementName

The short, singular name of the type of child elements in the collection.

protected override string SingularElementName { get; }

Property Value

string

Remarks

This value is used within the design-time environment when indicating the count of elements in the collection.

See Also

Methods

Adds the specified item to the collection.

public BarCommandLink Add(BarCommandLink item)
Parameter Type Description
item BarCommandLink

The BarCommandLink to add to the collection.

Returns

BarCommandLink:

The BarCommandLink that was created.

Adds multiple items to the collection.

public void AddRange(IEnumerable<BarCommandLink> items)
Parameter Type Description
items IEnumerable<BarCommandLink>

The enumerable of BarCommandLink objects to add.

Clear()

Removes all items from the collection.

public void Clear()

CloneToArray()

Copies the items of the collection to a new BarCommandLink array.

public BarCommandLink[] CloneToArray()

Returns

BarCommandLink[]:

An array of BarCommandLink items.

Contains(string)

Determines whether a BarCommandLink that is based on a BarCommand with the specified FullName is in the collection.

public virtual bool Contains(string commandFullName)
Parameter Type Description
commandFullName string

The FullName to locate in the collection.

Returns

bool:

true if a BarCommandLink that is based on a BarCommand with the specified FullName is in the collection; otherwise, false.

Returns the index of the next visible BarCommandLink that occurs after the specified index.

public int FindNextVisibleCommandLink(int startIndex)
Parameter Type Description
startIndex int

The index of the exclusive starting point of the search.

Returns

int

Returns the index of the next visible BarCommandLink that occurs before the specified index.

public int FindPreviousVisibleCommandLink(int startIndex)
Parameter Type Description
startIndex int

The index of the exclusive starting point of the search.

Returns

int

GetEnumerator()

Returns an enumerator that iterates through the collection.

public IEnumerator<BarCommandLink> GetEnumerator()

Returns

IEnumerator<BarCommandLink>:

An enumerator that can be used to iterate through the collection.

IndexOf(string, bool)

Searches for a BarCommandLink that is based on a BarCommand with the specified FullName, and returns the zero-based index of the first occurrence within the entire collection.

public virtual int IndexOf(string commandFullName, bool visibleOnly)
Parameter Type Description
commandFullName string

The FullName to locate in the collection.

visibleOnly bool

Whether to only look for visible command links.

Returns

int:

The zero-based index of the first occurrence of a BarCommandLink that is based on a BarCommand with the specified FullName within the entire collection, if found; otherwise, -1.

IndexOf(string, string?, int, bool)

Searches for a BarCommandLink that is based on a BarCommand with the specified FullName, and returns the zero-based index of the first occurrence at or after the start index.

public virtual int IndexOf(string commandFullName, string? defaultText, int startIndex, bool visibleOnly)
Parameter Type Description
commandFullName string

The FullName to locate in the collection.

defaultText string

The default text of the BarCommandLink. This value can be null to allow any default text.

startIndex int

The start index to search.

visibleOnly bool

Whether to only look for visible command links.

Returns

int:

The zero-based index of the first occurrence of a BarCommandLink that is based on a BarCommand with the specified FullName at or after the start index, if found; otherwise, -1.

Inserts a BarCommandLink into the collection at the specified index.

public BarCommandLink Insert(int index, BarCommandLink item)
Parameter Type Description
index int

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

item BarCommandLink

The BarCommandLinkto insert.

Returns

BarCommandLink:

The BarCommandLink that was inserted.

OnObjectAdded(int, ILogicalTreeNode)

Performs additional custom processes after an object is added to the collection.

protected override void OnObjectAdded(int index, ILogicalTreeNode value)
Parameter Type Description
index int

The zero-based index at which the object was inserted.

value ILogicalTreeNode

The object that was inserted.

Remarks

The default implementation of this method is intended to be overridden by a derived class to perform some action after the specified object is added.

OnObjectRemoving(int, ILogicalTreeNode)

Performs additional custom processes before an object is removed from the collection.

protected override void OnObjectRemoving(int index, ILogicalTreeNode value)
Parameter Type Description
index int

The zero-based index from which the object was removed.

value ILogicalTreeNode

The object that was removed.

Remarks

The default implementation of this method is intended to be overridden by a derived class to perform some action before the specified object is removed.

OnValidate(ILogicalTreeNode, int)

Performs additional custom processes when validating a value.

protected override void OnValidate(ILogicalTreeNode value, int existingIndex)
Parameter Type Description
value ILogicalTreeNode

The object to validate.

existingIndex int

The index within the collection of the object that would be replaced by the value.

Remarks

The default implementation of this method determines whether value is null, and if so, throws ArgumentNullException. It is intended to be overridden by a derived class to perform additional action when the specified element is validated.

Removes the specified item from the collection.

public void Remove(BarCommandLink item)
Parameter Type Description
item BarCommandLink

The BarCommandLink to remove.

RemoveAt(int)

Removes the BarCommandLink at the specified index in the collection.

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

The zero-based index of the BarCommandLink to be removed.

ToArray()

Copies the items of the collection to a new BarCommandLink array.

public BarCommandLink[] ToArray()

Returns

BarCommandLink[]:

An array of BarCommandLink items.

Inherited Members

Extension Methods