Button
The Button
control is a ContentControl
which reacts to pointer presses.
A button notifies clicks by raising the Click
event. A click is distinct from a PointerDown
event in that it is raised by default when the button is pressed and then released (although this behavior can be changed by setting the ClickMode
property).
Alternatively an instance of ICommand
can be assigned or bound to the button's Command
property. This command will be executed when the button is clicked. For more information see binding to commands.
Click
is just one of several events that Buttons have. Another example is PointerEnter
or PointerLeave
. You can get the full list of Button Events here.
The Button control's full documentation can be found here
Subclasses
- ToggleButton - Toggles between checked and unchecked on click.
Common Properties
Property | Description |
---|---|
ClickMode | Describes how the button should react to clicks |
Command | A command to be invoked when the button is clicked |
CommandParameter | A parameter to be passed to Command |
Content | The content to display in the button |
IsDefault | When set, pressing the enter key clicks the button even if not focused |
IsPressed | Set when the button is depressed |
Pseudoclasses
Pseudoclass | Description |
---|---|
:pressed | Set when the button is depressed |