Image Button
Represents an image button control that reacts to touch events.
Remarks
In most scenarios, we recommend using the standard Button control. It is a bit more flexible in that it can display text, custom images, & icons from the built-in icon libarary. This ImageButton control cannot use icons from the built-in icon library.
What the ImageButton has that the standard Button does not is support for the Image Stretch
property. If Stretch
is required you should use this control instead of the standard Button.
Properties
Property | Type | Description |
---|---|---|
Background | Color | The background color of the control. |
Border | Color | The color of the control's border. |
BorderThickness | Float | The width of the control's border. |
CornerRadius | Integer | The radius for the corners of the control's border. |
Foreground | Color | The color of the control's content. |
Image | Image | The image for the control. |
Stretch | Enum | A value that specifies how an Image should be stretched to fill the destination rectangle. Possible values are Fill , Uniform , & UniformToFill . |
ButtonType | Enum | The type of button. Possible values are Normal , Repeat , & Toggle . |
IsChecked | Boolean | A value that indicates whether the button is checked. This applies only when ButtonType is set to Toggle |
IsPressed | Boolean | A value that indicates whether the button is currently in a pressed state. |
RepeatInterval | Integer | The time, in milliseconds, between repetitions of the click action, as soon as repeating starts. This applies only when ButtonType is set to Repeat . |
Height | Float | The suggested height of the control in dp pixels. |
HorizontalAlignment | Enum | The horizontal alignment characteristics that are applied to the control when it is composed in a parent layout panel, such as a Grid. |
Margin | Thickness | The outer margin that is applied to the control when it is composed in a parent layout panel, such as a Grid. |
Padding | Thickness | The amount of space between the content of the control and its border. |
Rotation | Integer | The rotation about the Z-axis in degrees. |
VerticalAlignment | Enum | The vertical alignment characteristics that are applied to the control when it is composed in a parent layout panel, such as a Grid. |
Width | Float | The suggested width of the control in dp pixels. |
IsEnabled | Boolean | A value that indicates whether the user can interact with the control. |
IsHitTestVisible | Boolean | A value that indicates whether the contained area of the control can return true values for hit testing. |
IsVisible | Boolean | A value that indicates whether the control should be visible. |
Opacity | Float | A value between 0 and 1.0 that declares the opacity factor, with 1.0 meaning full opacity and 0 meaning transparent. |
Events
Event | Description |
---|---|
Loaded | Occurs when the element is laid out, rendered, and ready for interaction. |
Unloaded | Occurs when the element is no longer rendered on the screen. |
Clicked | Occurs when the button control is clicked. |
Pressed | Occurs when the button control is pressed. |
Released | Occurs when the button control is released. |
Canceled | Occurs when the button control click is canceled. |
Checked | Occurs when the button is checked. This applies only when ButtonType is set to Toggle . |
Unchecked | Occurs when the button is unchecked. This applies only when ButtonType is set to Toggle . |