Table of Contents

Class Button

Namespace
Stride.UI.Controls
Assembly
Stride.UI.dll

Represents a Windows button control, which reacts to the Click event.

[DataContract("Button")]
[DataContractMetadataType(typeof(Button.ButtonMetadata))]
public class Button : ButtonBase, IUIElementUpdate, IUIElementChildren, IIdentifiable
Inheritance
Button
Implements
Derived
Inherited Members
Extension Methods

Constructors

Button()

public Button()

Properties

ImageStretchDirection

Gets or sets a value that indicates how the button image is scaled.

[DataMember]
[Display(null, "Layout")]
public StretchDirection ImageStretchDirection { get; set; }

Property Value

StretchDirection

Remarks

This property has no effect is SizeToContent is true.

ImageStretchType

Gets or sets a value that describes how the button image should be stretched to fill the destination rectangle.

[DataMember]
[Display(null, "Layout")]
public StretchType ImageStretchType { get; set; }

Property Value

StretchType

Remarks

This property has no effect is SizeToContent is true.

IsPressed

Gets a value that indicates whether the button is currently down.

public override bool IsPressed { get; protected set; }

Property Value

bool

MouseOverImage

Gets or sets the image displayed when the mouse hovers over the button.

[DataMember]
[Display(null, "Appearance")]
public ISpriteProvider MouseOverImage { get; set; }

Property Value

ISpriteProvider

NotPressedImage

Gets or sets the image displayed when the button is not pressed.

[DataMember]
[Display(null, "Appearance")]
public ISpriteProvider NotPressedImage { get; set; }

Property Value

ISpriteProvider

PressedImage

Gets or sets the image displayed when the button is pressed.

[DataMember]
[Display(null, "Appearance")]
public ISpriteProvider PressedImage { get; set; }

Property Value

ISpriteProvider

SizeToContent

Gets or sets whether the size depends on the Content. The default is true.

[DataMember]
[Display(null, "Layout")]
public bool SizeToContent { get; set; }

Property Value

bool

Methods

ArrangeOverride(Vector3)

When overridden in a derived class, positions possible child elements and determines a size for a UIElement derived class.

protected override Vector3 ArrangeOverride(Vector3 finalSizeWithoutMargins)

Parameters

finalSizeWithoutMargins Vector3

The final area within the parent that this element should use to arrange itself and its children.

Returns

Vector3

The actual size used.

MeasureOverride(Vector3)

When overridden in a derived class, measures the size in layout required for possible child elements and determines a size for the UIElement-derived class.

protected override Vector3 MeasureOverride(Vector3 availableSizeWithoutMargins)

Parameters

availableSizeWithoutMargins Vector3

The available size that this element can give to child elements. Infinity can be specified as a value to indicate that the element will size to whatever content is available.

Returns

Vector3

The size desired by the children

OnAspectImageInvalidated()

Function triggered when one of the PressedImage and NotPressedImage images are invalidated. This function can be overridden in inherited classes.

protected virtual void OnAspectImageInvalidated()