# ComponentToolCollection

Namespace: **Wisej.Web**

Assembly: **Wisej.Framework** (4.0.0.0)

Represents a set of tool widgets associated with a component. The component includes the tools panel according to its design. For example, the [Form](https://docs.wisej.com/api/wisej.web/containers/form) component includes the tools in its caption bar. Other components may include the tools elsewhere.

{% tabs %}
{% tab title="C#" %}

```csharp
public class ComponentToolCollection : IList, ICollection, IEnumerable, IList<ComponentTool>, ICollection<ComponentTool>, IEnumerable<ComponentTool>
```

{% endtab %}

{% tab title="VB.NET" %}

```visual-basic
Public Class ComponentToolCollection
    Inherits IList
    Implements ICollection, IEnumerable, IList(Of ComponentTool), ICollection(Of ComponentTool), IEnumerable(Of ComponentTool)
```

{% endtab %}
{% endtabs %}

## Constructors

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) ComponentToolCollection()

Initializes a new instance of the [ComponentToolCollection](https://docs.wisej.com/api/wisej.web/editors/wisej.web.componenttoolcollection) class not bound to any control.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) ComponentToolCollection(owner)

Initializes a new instance of the [ComponentToolCollection](https://docs.wisej.com/api/wisej.web/editors/wisej.web.componenttoolcollection) class.

| Name      | Type                                                            | Description                                                                                            |
| --------- | --------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ |
| **owner** | [Control](https://docs.wisej.com/api/wisej.web/general/control) | The [Control](https://docs.wisej.com/api/wisej.web/general/control) control that owns this collection. |

## Properties

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) IsReadOnly

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Returns a value indicating whether this collection is read-only.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) Item(index)

[ComponentTool](https://docs.wisej.com/api/wisej.web/editors/wisej.web.componenttool): Returns or sets the [ComponentTool](https://docs.wisej.com/api/wisej.web/editors/wisej.web.componenttool) at the specified index.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) Item(name)

[ComponentTool](https://docs.wisej.com/api/wisej.web/editors/wisej.web.componenttool): Returns the [ComponentTool](https://docs.wisej.com/api/wisej.web/editors/wisej.web.componenttool) identified by the name.

## Methods

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) Add(name, imageSource)

Adds a [ComponentTool](https://docs.wisej.com/api/wisej.web/editors/wisej.web.componenttool) with the specified name and image source to the collection.

| Parameter       | Type                                                          | Description                                                                                                                 |
| --------------- | ------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
| **name**        | [String](https://docs.microsoft.com/dotnet/api/system.string) | The name of the [ComponentTool](https://docs.wisej.com/api/wisej.web/editors/wisej.web.componenttool) that is being added.  |
| **imageSource** | [String](https://docs.microsoft.com/dotnet/api/system.string) | The image of the [ComponentTool](https://docs.wisej.com/api/wisej.web/editors/wisej.web.componenttool) that is being added. |

**Returns:** [ComponentTool](https://docs.wisej.com/api/wisej.web/editors/wisej.web.componenttool). A [ComponentTool](https://docs.wisej.com/api/wisej.web/editors/wisej.web.componenttool) that represents the panel that was added to the collection.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) Add(tool)

Adds a [ComponentTool](https://docs.wisej.com/api/wisej.web/editors/wisej.web.componenttool) to the collection.

| Parameter | Type                                                                                  | Description                                                                                                                                 |
| --------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
| **tool**  | [ComponentTool](https://docs.wisej.com/api/wisej.web/editors/wisej.web.componenttool) | A [ComponentTool](https://docs.wisej.com/api/wisej.web/editors/wisej.web.componenttool) that represents the panel to add to the collection. |

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception)\
  The [ComponentTool](https://docs.wisej.com/api/wisej.web/editors/wisej.web.componenttool) being added to the collection was null.
* [ArgumentException](https://docs.microsoft.com/dotnet/api/system.argumentexception)\
  The parent of the [ComponentTool](https://docs.wisej.com/api/wisej.web/editors/wisej.web.componenttool) specified in the *tool* parameter is not null.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) AddRange(tools)

Adds an array of [ComponentTool](https://docs.wisej.com/api/wisej.web/editors/wisej.web.componenttool) to the collection

| Parameter | Type                                                                                      | Description |
| --------- | ----------------------------------------------------------------------------------------- | ----------- |
| **tools** | [ComponentTool\[\]](https://docs.wisej.com/api/wisej.web/editors/wisej.web.componenttool) |             |

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) Clear()

Removes all tools from the collection.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) Clear(dispose)

Removes and optionally disposes all tools from the collection.

| Parameter   | Type                                                            | Description                                             |
| ----------- | --------------------------------------------------------------- | ------------------------------------------------------- |
| **dispose** | [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean) | Indicates whether the removed items should be disposed. |

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) Contains(tool)

Determines whether the specified panel is located within the collection.

| Parameter | Type                                                                                  | Description                                                                                                            |
| --------- | ------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
| **tool**  | [ComponentTool](https://docs.wisej.com/api/wisej.web/editors/wisej.web.componenttool) | The [ComponentTool](https://docs.wisej.com/api/wisej.web/editors/wisej.web.componenttool) to locate in the collection. |

**Returns:** [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean). true if the panel is located within the collection; otherwise, false.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) ContainsKey(key)

Determines whether the collection contains a [ComponentTool](https://docs.wisej.com/api/wisej.web/editors/wisej.web.componenttool) with the specified key.

| Parameter | Type                                                          | Description                                     |
| --------- | ------------------------------------------------------------- | ----------------------------------------------- |
| **key**   | [String](https://docs.microsoft.com/dotnet/api/system.string) | The name of the item to find in the collection. |

**Returns:** [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean). true to indicate the collection contains a [ComponentTool](https://docs.wisej.com/api/wisej.web/editors/wisej.web.componenttool) with the specified key; otherwise, false.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) GetEnumerator()

Returns an enumerator to use to iterate through the item collection.

**Returns:** [IEnumerator](https://docs.microsoft.com/dotnet/api/system.collections.ienumerator). An [IEnumerator](https://docs.microsoft.com/dotnet/api/system.collections.ienumerator) that represents the item collection.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) IndexOf(tool)

Returns the index within the collection of the specified panel.

| Parameter | Type                                                                                  | Description                                                                                                            |
| --------- | ------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
| **tool**  | [ComponentTool](https://docs.wisej.com/api/wisej.web/editors/wisej.web.componenttool) | The [ComponentTool](https://docs.wisej.com/api/wisej.web/editors/wisej.web.componenttool) to locate in the collection. |

**Returns:** [Int32](https://docs.microsoft.com/dotnet/api/system.int32). The zero-based index where the panel is located within the collection; otherwise, negative one (-1).

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) IndexOfKey(key)

Returns the index of the first occurrence of a [ComponentTool](https://docs.wisej.com/api/wisej.web/editors/wisej.web.componenttool) with the specified key.

| Parameter | Type                                                          | Description                                                                                                                      |
| --------- | ------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
| **key**   | [String](https://docs.microsoft.com/dotnet/api/system.string) | The name of the [ComponentTool](https://docs.wisej.com/api/wisej.web/editors/wisej.web.componenttool) to find in the collection. |

**Returns:** [Int32](https://docs.microsoft.com/dotnet/api/system.int32). The zero-based index of the first occurrence of the [ComponentTool](https://docs.wisej.com/api/wisej.web/editors/wisej.web.componenttool) with the specified key, if found; otherwise, -1.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) Insert(index, tool)

Inserts the specified [ComponentTool](https://docs.wisej.com/api/wisej.web/editors/wisej.web.componenttool) into the collection at the specified index.

| Parameter | Type                                                                                  | Description                                                                                                               |
| --------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
| **index** | [Int32](https://docs.microsoft.com/dotnet/api/system.int32)                           | The zero-based index location where the panel is inserted.                                                                |
| **tool**  | [ComponentTool](https://docs.wisej.com/api/wisej.web/editors/wisej.web.componenttool) | A [ComponentTool](https://docs.wisej.com/api/wisej.web/editors/wisej.web.componenttool) representing the panel to insert. |

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception)\
  The *tool* parameter is null.
* [ArgumentException](https://docs.microsoft.com/dotnet/api/system.argumentexception)\
  The *tool* parameter's parent is not null.
* [ArgumentOutOfRangeException](https://docs.microsoft.com/dotnet/api/system.argumentoutofrangeexception)\
  The *index* parameter is less than zero or greater than the value of the [Count](#count) property of the [ComponentToolCollection](https://docs.wisej.com/api/wisej.web/editors/wisej.web.componenttoolcollection) class.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) Remove(tool)

Removes the specified [ComponentTool](https://docs.wisej.com/api/wisej.web/editors/wisej.web.componenttool) from the collection.

| Parameter | Type                                                                                  | Description                                                                                                                                     |
| --------- | ------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| **tool**  | [ComponentTool](https://docs.wisej.com/api/wisej.web/editors/wisej.web.componenttool) | The [ComponentTool](https://docs.wisej.com/api/wisej.web/editors/wisej.web.componenttool) representing the panel to remove from the collection. |

**Returns:** [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean).

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception)\
  The [ComponentTool](https://docs.wisej.com/api/wisej.web/editors/wisej.web.componenttool) assigned to the *tool* parameter is null.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) RemoveAt(index)

Removes the [ComponentTool](https://docs.wisej.com/api/wisej.web/editors/wisej.web.componenttool) located at the specified index within the collection.

| Parameter | Type                                                        | Description                                 |
| --------- | ----------------------------------------------------------- | ------------------------------------------- |
| **index** | [Int32](https://docs.microsoft.com/dotnet/api/system.int32) | The zero-based index of the item to remove. |

**Throws:**

* [ArgumentOutOfRangeException](https://docs.microsoft.com/dotnet/api/system.argumentoutofrangeexception)\
  The *index* parameter is less than zero or greater than or equal to the value of the [Count](#count) property of the [ComponentToolCollection](https://docs.wisej.com/api/wisej.web/editors/wisej.web.componenttoolcollection) class.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) RemoveByKey(key)

Removes the [ComponentTool](https://docs.wisej.com/api/wisej.web/editors/wisej.web.componenttool) with the specified key from the collection.

| Parameter | Type                                                          | Description                                                                                                                          |
| --------- | ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
| **key**   | [String](https://docs.microsoft.com/dotnet/api/system.string) | The name of the [ComponentTool](https://docs.wisej.com/api/wisej.web/editors/wisej.web.componenttool) to remove from the collection. |
