Class Button
- Namespace
- Myra.Graphics2D.UI
- Assembly
- Myra.dll
A clickable button widget that can contain any widget as its content.
public class Button : ButtonBase, IItemWithId, INotifyAttachedPropertyChanged, IContent
- Inheritance
-
Button
- Implements
- Inherited Members
Constructors
Button(Stylesheet, string)
Initializes a new instance of the Button class with the specified stylesheet and style.
public Button(Stylesheet stylesheet, string styleName = "")
Parameters
stylesheetStylesheetThe stylesheet to use for applying the style.
styleNamestringThe name of the style to apply. Defaults to the default stylesheet style.
Button(string)
Initializes a new instance of the Button class with the specified style.
public Button(string styleName = "")
Parameters
styleNamestringThe name of the style to apply. Defaults to the default stylesheet style.
Properties
Content
Gets or sets the content widget displayed inside the button.
[Browsable(false)]
public override Widget Content { get; set; }
Property Value
Desktop
Gets or sets the desktop that contains this button.
public override Desktop Desktop { get; }
Property Value
Methods
CreateTextButton(string)
Creates a button with a text label as its content.
public static Button CreateTextButton(string text)
Parameters
textstringThe text to display on the button.
Returns
- Button
A new Button with a text label.
InternalOnTouchDown()
Called when a touch point is pressed on the button.
protected override void InternalOnTouchDown()
InternalOnTouchUp()
Called when a touch point is released on the button.
protected override void InternalOnTouchUp()
OnKeyDown(Keys)
Handles keyboard input for the button, simulating a click when Space is pressed.
public override void OnKeyDown(Keys k)
Parameters
kKeysThe key being pressed.
OnTouchLeft()
Handles the event when the cursor/touch leaves the button.
public override void OnTouchLeft()