Table of Contents

Method InsertButton

Namespace
Alternet.Maui
Assembly
Alternet.UI.Maui.dll

InsertButton(int, string?, string?, SvgImage?, Action?)

Inserts a button into the toolbar at the specified index.

public virtual SimpleToolBarView.IToolBarItem InsertButton(int index, string? text, string? toolTip = null, SvgImage? image = null, Action? onClick = null)

Parameters

index int

The zero-based index at which the button should be inserted. Must be within the valid range of the toolbar's items.

text string

The text to display on the button. Can be null if no text is required.

toolTip string

The tooltip text to display when the user hovers over the button. Can be null if no tooltip is required.

image SvgImage

An optional SVG image to display on the button. Can be null if no image is required.

onClick Action

An optional action to execute when the button is clicked. Can be null if no action is required.

Returns

SimpleToolBarView.IToolBarItem

The newly created toolbar button.

Remarks

The method creates a new toolbar button, initializes its properties, and inserts it into the toolbar at the specified index. If the index is out of range, an exception will be thrown.