Button Template - LiruJ/GuiCookie GitHub Wiki

Overview

A button is an element that handles player clicks. The base Button template acts as a clickable Pane with no text or image.

Definition

<Button Components="Frame, MouseHandler" Controller="Button"/>

<TextButton Components="Frame, TextBlock, MouseHandler" Controller="TextButton"/>

<ImageButton Components="Frame, ImageBlock, MouseHandler" Controller="ImageButton"/>

A Button template defines a Frame and MouseHandler component, with its controller being Button

The TextButton template also defines a TextBlock component and uses TextButton as its controller.

The ImageButton template defines an ImageBlock instead of the TextBlock, and uses ImageButton as its controller.

Usage

Button

<Button Size="128, 32"/>

Simply adding a button is all that is needed. It will appear as a frame that can be clicked.

TextButton

<TextButton Size="128, 32" Text="This is a button"/>

Adding the text button is enough for a normal button, the text attribute sets the starting text of the button.

ImageButton

<ImageButton Size="128, 32" Image="ButtonIcon"/>

Adding the image button is enough for a normal button, the image attribute sets the image to the image with the given name, defined in the images resource node of the style sheet.

⚠️ **GitHub.com Fallback** ⚠️