Button Class
Namespace: Stride.UI.ControlsAssembly: 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
              | Name | Description | |
|---|---|---|
| Constructors | ||
| Button() | ||
| Properties | ||
| ImageStretchDirection | Gets or sets a value that indicates how the button image is scaled.  | 
                          |
| ImageStretchType | Gets or sets a value that describes how the button image should be stretched to fill the destination rectangle.  | 
                          |
| IsPressed | Gets a value that indicates whether the button is currently down.  | 
                          |
| MouseOverImage | Gets or sets the image displayed when the mouse hovers over the button.  | 
                          |
| NotPressedImage | Gets or sets the image displayed when the button is not pressed.  | 
                          |
| PressedImage | Gets or sets the image displayed when the button is pressed.  | 
                          |
| SizeToContent | Gets or sets whether the size depends on the Content. The default is   | 
                          |
| Methods | ||
| ArrangeOverride(Vector3) | ||
| MeasureOverride(Vector3) | ||
| OnAspectImageInvalidated() | Function triggered when one of the PressedImage and NotPressedImage images are invalidated. This function can be overridden in inherited classes.  | 
                          |
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
| Type | Description | 
|---|---|
| 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
| Type | Description | 
|---|---|
| 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
| Type | Description | 
|---|---|
| System.Boolean | 
Overrides
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
| Type | Description | 
|---|---|
| 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
| Type | Description | 
|---|---|
| ISpriteProvider | 
PressedImage
Gets or sets the image displayed when the button is pressed.
[DataMember]
[Display(null, "Appearance")]
public ISpriteProvider PressedImage { get; set; }
              Property Value
| Type | Description | 
|---|---|
| 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
| Type | Description | 
|---|---|
| System.Boolean | 
Methods
ArrangeOverride(Vector3)
protected override Vector3 ArrangeOverride(Vector3 finalSizeWithoutMargins)
              Parameters
| Type | Name | Description | 
|---|---|---|
| Vector3 | finalSizeWithoutMargins | 
Returns
| Type | Description | 
|---|---|
| Vector3 | 
Overrides
MeasureOverride(Vector3)
protected override Vector3 MeasureOverride(Vector3 availableSizeWithoutMargins)
              Parameters
| Type | Name | Description | 
|---|---|---|
| Vector3 | availableSizeWithoutMargins | 
Returns
| Type | Description | 
|---|---|
| Vector3 | 
Overrides
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()