Table of Contents

Method AddButton

Namespace
Alternet.UI
Assembly
Alternet.UI.Common.dll

AddButton(string, Action?)

Adds a new button with the specified text and click action to the panel.

public virtual Button AddButton(string text, Action? clickAction = null)

Parameters

text string

The text to display on the button. Cannot be null or empty.

clickAction Action

The action to execute when the button is clicked. Can be null.

Returns

Button

A Button instance representing the newly added button.

Exceptions

ArgumentException

Thrown if text is null or empty.

AddButton(KnownButton, Action?)

Adds a new button to the current container with the specified behavior.

public virtual Button AddButton(KnownButton button, Action? clickAction = null)

Parameters

button KnownButton

A KnownButton value that specifies the type of button to add.

clickAction Action

An Action to be executed when the button is clicked.

Returns

Button

A Button instance representing the newly added button.

Remarks

The button's text is determined by the specified button type. The clickAction is invoked whenever the button is clicked. The new button is added as a child to the panel.