ToggleButton
Note: You can check the Avalonia docs for the ToggleButton and ToggleButton API if you need more information.
For Avalonia.FuncUI's DSL properties you can check ToggleButton.fs
If you are looking for a button to behave more like a checkbox you can use a ToggleButton
. A ToggleButton
toggles between checked and unchecked on click.
A ToggleButton
is a subclasses of Button so they share all the same attributes as described on that documentation page. A ToggleButton
behaves similar to a CheckBox and shares similar attributes like making tristate ToggleButtons.
You need to
open Avaloina.Controls.Primatives
to accessToggleButton
attributes.
Usage
Toggling for Checked/Unchecked
Handling Checked and Unchecked Differently
Tristate Toggling
ToggleButton.isChecked
can take values that are bool
, Nullable<bool>
, or bool option
. When using tristate options however, you must use either Nullable<bool>
or bool option
. You can also handle each event state like above using onChecked
, onUncheked
, and onIndeterminate
.
Last updated