# ToolBarButton

Namespace: **Wisej.Web**

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

* [Component](/api/wisej.base/general/wisej.base.component.md)
  * [Component](/api/wisej.web/general/wisej.web.component.md)
    * [BindableComponent](/api/wisej.web/general/wisej.web.bindablecomponent.md)
      * [ToolBarButton](/api/wisej.web/containers/toolbar/wisej.web.toolbarbutton.md)

Represents an item in the [ToolBar](/api/wisej.web/containers/toolbar.md).

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

```csharp
public class ToolBarButton : BindableComponent, ICommandSource
```

{% endtab %}

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

```visual-basic
Public Class ToolBarButton
    Inherits BindableComponent
    Implements ICommandSource
```

{% endtab %}
{% endtabs %}

Change the type of item to display using the [Style](#style) property.

## Constructors

### ![](/files/hsR4ok3152WyAf8J2C1u) ToolBarButton()

Initializes a new instance of the [ToolBarButton](/api/wisej.web/containers/toolbar/wisej.web.toolbarbutton.md) class.

### ![](/files/hsR4ok3152WyAf8J2C1u) ToolBarButton(text)

Initializes a new instance of the [ToolBarButton](/api/wisej.web/containers/toolbar/wisej.web.toolbarbutton.md) class and displays the assigned text on the button.

| Name     | Type                                                          | Description                                                                                                   |
| -------- | ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
| **text** | [String](https://docs.microsoft.com/dotnet/api/system.string) | The text to display on the new [ToolBarButton](/api/wisej.web/containers/toolbar/wisej.web.toolbarbutton.md). |

## Properties

### ![](/files/hsR4ok3152WyAf8J2C1u) AllowHtml

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Returns or sets a value indicating that the control can display HTML in the Text property. (Default: `False`)

### ![](/files/hsR4ok3152WyAf8J2C1u) AppearanceKey

[String](https://docs.microsoft.com/dotnet/api/system.string): Sets the appearance key for the theme engine. (Default: `null`)

### ![](/files/hsR4ok3152WyAf8J2C1u) AutoShowLoader

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Returns or sets whether the application blocks the browser with a modal mask when this button is clicked and until the server is done processing the execution request. (Default: `False`)

[AutoShowLoader](#autoshowloader) blocks the entire browser as soon as the button is clicked since it's implemented on the client side, while [ShowLoader](/api/wisej.web/general/control.md#showloader) blocks the specific widget when returning from the request.

### ![](/files/hsR4ok3152WyAf8J2C1u) Command

[ICommand](/api/wisej.web/interfaces/wisej.web.icommand.md): Returns or sets the [ICommand](/api/wisej.web/interfaces/wisej.web.icommand.md) implementation to invoke. (Default: `null`)

### ![](/files/hsR4ok3152WyAf8J2C1u) DropDownMenu

[ContextMenu](/api/wisej.web/menus/wisej.web.contextmenu.md): Returns or sets the menu to be displayed in the drop-down toolbar button. (Default: `null`)

### ![](/files/hsR4ok3152WyAf8J2C1u) Enabled

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Returns or sets whether the button is enabled. (Default: `True`)

### ![](/files/hsR4ok3152WyAf8J2C1u) ForeColor

[Color](https://docs.microsoft.com/dotnet/api/system.drawing.color): Returns or sets the text color of the toolbar button.

### ![](/files/hsR4ok3152WyAf8J2C1u) Image

[Image](https://docs.microsoft.com/dotnet/api/system.drawing.image): Returns or sets the image that is displayed in a [ToolBarButton](/api/wisej.web/containers/toolbar/wisej.web.toolbarbutton.md).

### ![](/files/hsR4ok3152WyAf8J2C1u) ImageIndex

[Int32](https://docs.microsoft.com/dotnet/api/system.int32): Returns or sets the index value of the image assigned to the [ToolBarButton](/api/wisej.web/containers/toolbar/wisej.web.toolbarbutton.md). (Default: `-1`)

**Throws:**

* [ArgumentOutOfRangeException](https://docs.microsoft.com/dotnet/api/system.argumentoutofrangeexception)\
  The specified index is less than -1.

### ![](/files/hsR4ok3152WyAf8J2C1u) ImageKey

[String](https://docs.microsoft.com/dotnet/api/system.string): Returns or sets the name of the image assigned to the button. (Default: `""`)

### ![](/files/hsR4ok3152WyAf8J2C1u) ImageSource

[String](https://docs.microsoft.com/dotnet/api/system.string): Returns or sets the theme name or URL for the image to display in the [ToolBarButton](/api/wisej.web/containers/toolbar/wisej.web.toolbarbutton.md).

### ![](/files/hsR4ok3152WyAf8J2C1u) Margin

[Padding](/api/wisej.web/general/wisej.web.padding.md): Returns or sets the space between toolbar buttons.

### ![](/files/hsR4ok3152WyAf8J2C1u) Name

[String](https://docs.microsoft.com/dotnet/api/system.string): Returns or sets the name of the [ToolBarButton](/api/wisej.web/containers/toolbar/wisej.web.toolbarbutton.md).

### ![](/files/hsR4ok3152WyAf8J2C1u) Padding

[Padding](/api/wisej.web/general/wisej.web.padding.md): Returns or sets padding within the toolbar button.

### ![](/files/hsR4ok3152WyAf8J2C1u) Parent

[ToolBar](/api/wisej.web/containers/toolbar.md): Returns the toolbar control that the toolbar button is assigned to.

### ![](/files/hsR4ok3152WyAf8J2C1u) Pushed

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Returns or sets whether a toggle-style toolbar button is currently in the pushed state. (Default: `False`)

### ![](/files/hsR4ok3152WyAf8J2C1u) SizeMode

[ToolBarButtonSizeMode](/api/wisej.web/containers/toolbar/wisej.web.toolbarbuttonsizemode.md): Returns or sets how the toolbar button is resized. (Default: `Auto`)

### ![](/files/hsR4ok3152WyAf8J2C1u) Style

[ToolBarButtonStyle](/api/wisej.web/containers/toolbar/wisej.web.toolbarbuttonstyle.md): Returns or sets the style of the toolbar button. (Default: `PushButton`)

### ![](/files/hsR4ok3152WyAf8J2C1u) Tag

[Object](https://docs.microsoft.com/dotnet/api/system.object): Returns or sets the object that contains data about the toolbar button. (Default: `null`)

### ![](/files/hsR4ok3152WyAf8J2C1u) Text

[String](https://docs.microsoft.com/dotnet/api/system.string): Returns or sets the text displayed on the toolbar button. (Default: `""`)

When AllowHtml is set to true, the text can contain HTML content. If the text contains new lines (CRLF) but doesn't contain HTML elements (at least one "<") all CRLF are automatically substituted with "\<br/>".

### ![](/files/hsR4ok3152WyAf8J2C1u) ToolTipText

[String](https://docs.microsoft.com/dotnet/api/system.string): Returns or sets the text that appears as a ToolTip for the button. (Default: `""`)

### ![](/files/hsR4ok3152WyAf8J2C1u) Visible

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Returns or sets whether the toolbar button is visible or hidden. (Default: `True`)

## Methods

### ![](/files/lzopMboA31bVq8UIcbT3) Dispose(disposing)

Releases the resources used by the [ToolBarButton](/api/wisej.web/containers/toolbar/wisej.web.toolbarbutton.md).

| Parameter     | Type                                                            | Description                                                                 |
| ------------- | --------------------------------------------------------------- | --------------------------------------------------------------------------- |
| **disposing** | [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean) | true when this method is called by the application rather than a finalizer. |

### ![](/files/lzopMboA31bVq8UIcbT3) OnAddReferences(items)

Returns a collection of referenced components or collection of components.

| Parameter | Type                                                                    | Description |
| --------- | ----------------------------------------------------------------------- | ----------- |
| **items** | [IList](https://docs.microsoft.com/dotnet/api/system.collections.ilist) |             |

### ![](/files/hsR4ok3152WyAf8J2C1u) OnClick(e)

Fires the [Click](#click) event.

| Parameter | Type                                                                | Description                                                                                          |
| --------- | ------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
| **e**     | [EventArgs](https://docs.microsoft.com/dotnet/api/system.eventargs) | An [EventArgs](https://docs.microsoft.com/dotnet/api/system.eventargs) that contains the event data. |

### ![](/files/lzopMboA31bVq8UIcbT3) OnCommandChanged(e)

Fires the [CommandChanged](#commandchanged) event.

| Parameter | Type                                                                | Description                                                                                         |
| --------- | ------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
| **e**     | [EventArgs](https://docs.microsoft.com/dotnet/api/system.eventargs) | A [EventArgs](https://docs.microsoft.com/dotnet/api/system.eventargs) that contains the event data. |

### ![](/files/lzopMboA31bVq8UIcbT3) OnPushedChanged(e)

Fires the [PushedChanged](#pushedchanged) event.

| Parameter | Type                                                                | Description                                                                                         |
| --------- | ------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
| **e**     | [EventArgs](https://docs.microsoft.com/dotnet/api/system.eventargs) | A [EventArgs](https://docs.microsoft.com/dotnet/api/system.eventargs) that contains the event data. |

### ![](/files/lzopMboA31bVq8UIcbT3) OnWebRender(config)

Renders the client component.

| Parameter  | Type                                                          | Description                   |
| ---------- | ------------------------------------------------------------- | ----------------------------- |
| **config** | [Object](https://docs.microsoft.com/dotnet/api/system.object) | Dynamic configuration object. |

### ![](/files/hsR4ok3152WyAf8J2C1u) PerformClick()

Generates the [Click](#click) and [ButtonClick](/api/wisej.web/containers/toolbar.md#buttonclick) events.

### ![](/files/hsR4ok3152WyAf8J2C1u) Update()

Updates the component on the client. Overridden to repaint the toolbar in design mode.

### ![](/files/lzopMboA31bVq8UIcbT3) ValidateActiveControl()

Validates the current control.

**Returns:** [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean). true if the active control is validated.

## Events

### ![](/files/hsR4ok3152WyAf8J2C1u) Click

[EventHandler](https://docs.microsoft.com/dotnet/api/system.eventhandler) Fired when the control is clicked.

### ![](/files/hsR4ok3152WyAf8J2C1u) CommandChanged

[EventHandler](https://docs.microsoft.com/dotnet/api/system.eventhandler) Fired when the [Command](#command) property value changes.

### ![](/files/hsR4ok3152WyAf8J2C1u) PushedChanged

[EventHandler](https://docs.microsoft.com/dotnet/api/system.eventhandler) Fired when the [Pushed](#pushed) property value changes.

## Implements

| Name                                                                              | Description                                                                                                     |
| --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
| [IUserData](/api/wisej.web/interfaces/wisej.web.iuserdata.md)                     | Provides access to the `UserData` and `Tag` properties associated to the component implementing this interface. |
| [IBindableComponent](/api/wisej.web/data-binding/wisej.web.ibindablecomponent.md) | Bindable components implement this interface.                                                                   |
| [ICommandSource](/api/wisej.web/interfaces/wisej.web.icommandsource.md)           | Defines an object that can invoke a [Command](/api/wisej.web/interfaces/wisej.web.icommandsource.md#command).   |
| [IWisejComponent](/api/wisej.core/interfaces/wisej.core.iwisejcomponent.md)       | All wisej components implement this interface.                                                                  |
| [IWisejSerializable](/api/wisej.core/interfaces/wisej.core.iwisejserializable.md) | Allows an object to serialize itself.                                                                           |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.wisej.com/api/wisej.web/containers/toolbar/wisej.web.toolbarbutton.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
