# ToolBarButton

URL: https://docs.wisej.com/api/wisej.web/containers/toolbar/wisej.web.toolbarbutton

Version: 4.1
Namespace: **Wisej.Web**

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

- [Component](/api/wisej.base/general/wisej.base.component)
- [Component](/api/wisej.web/general/wisej.web.component)
- [BindableComponent](/api/wisej.web/general/wisej.web.bindablecomponent)
- [ToolBarButton](/api/wisej.web/containers/toolbar/wisej.web.toolbarbutton)
Represents an item in theToolBar .

- C# - VB.NET

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

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

Change the type of item to display using the [Style](/api/wisej.web/containers/toolbar/wisej.web.toolbarbutton#style) property.

## Constructors

### ![Instance member](/img/api/instance.png) ToolBarButton()

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

### ![Instance member](/img/api/instance.png) ToolBarButton(text)

Initializes a new instance of the [ToolBarButton](/api/wisej.web/containers/toolbar/wisej.web.toolbarbutton) 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) . 

## Properties

### ![Instance member](/img/api/instance.png) 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` )

### ![Instance member](/img/api/instance.png) AppearanceKey

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

### ![Instance member](/img/api/instance.png) 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](/api/wisej.web/containers/toolbar/wisej.web.toolbarbutton#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/#showloader) blocks the specific widget when returning from the request.

### ![Instance member](/img/api/instance.png) Command

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

### ![Instance member](/img/api/instance.png) DropDownMenu

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

### ![Instance member](/img/api/instance.png) Enabled

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

### ![Instance member](/img/api/instance.png) ForeColor

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

### ![Instance member](/img/api/instance.png) 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) .

### ![Instance member](/img/api/instance.png) 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) . (Default: `-1` )

**Throws:**

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

### ![Instance member](/img/api/instance.png) ImageKey

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

### ![Instance member](/img/api/instance.png) 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) .

### ![Instance member](/img/api/instance.png) Margin

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

### ![Instance member](/img/api/instance.png) 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) .

### ![Instance member](/img/api/instance.png) Padding

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

### ![Instance member](/img/api/instance.png) Parent

ToolBar : Returns the toolbar control that the toolbar button is assigned to.

### ![Instance member](/img/api/instance.png) 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` )

### ![Instance member](/img/api/instance.png) SizeMode

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

### ![Instance member](/img/api/instance.png) Style

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

### ![Instance member](/img/api/instance.png) Tag

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

### ![Instance member](/img/api/instance.png) 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/>".

### ![Instance member](/img/api/instance.png) ToolTipText

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

### ![Instance member](/img/api/instance.png) Visible

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

## Methods

### ![Protected member](/img/api/protected.png) Dispose(disposing)

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

| 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. 

### ![Protected member](/img/api/protected.png) 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) | 

### ![Instance member](/img/api/instance.png) OnClick(e)

Fires the [Click](/api/wisej.web/containers/toolbar/wisej.web.toolbarbutton#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. 

### ![Protected member](/img/api/protected.png) OnCommandChanged(e)

Fires the [CommandChanged](/api/wisej.web/containers/toolbar/wisej.web.toolbarbutton#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. 

### ![Protected member](/img/api/protected.png) OnPushedChanged(e)

Fires the [PushedChanged](/api/wisej.web/containers/toolbar/wisej.web.toolbarbutton#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. 

### ![Protected member](/img/api/protected.png) OnWebRender(config)

Renders the client component.

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

### ![Instance member](/img/api/instance.png) PerformClick()

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

### ![Instance member](/img/api/instance.png) Update()

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

### ![Protected member](/img/api/protected.png) ValidateActiveControl()

Validates the current control.

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

## Events

### ![Instance member](/img/api/instance.png) Click

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

### ![Instance member](/img/api/instance.png) CommandChanged

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

### ![Instance member](/img/api/instance.png) PushedChanged

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

## Implements

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