ButtonSpinner
The ButtonSpinner presents a control that includes buttons for spin-up and spin-down. The content of this button is flexible, but you will have to code quite a lot of the behavior.
Useful Properties
You will probably use these properties most often:
| Property | Description |
|---|---|
ButtonSpinnerLocation | Location of the spinner buttons: left or right. |
ValidSpinDirection | Used to limit spin direction: increase, decrease or none. |
Example
- XAML
- C#
<UserControl xmlns="https://github.com/avaloniaui" Padding="20"> <ButtonSpinner Spin="OnSpin" HorizontalAlignment="Center" VerticalAlignment="Center"> Press the spinner </ButtonSpinner> </UserControl>
public partial class MainView : UserControl { private int _currentValue = 0; public void OnSpin(object sender, SpinEventArgs args) { if (args.Direction == SpinDirection.Increase) _currentValue++; else _currentValue--; var btn = (ButtonSpinner)sender; btn.Content = $"Value: {_currentValue}"; } }
Preview
Loading Avalonia Preview...
More Information
info
For the complete API documentation about this control, see here.
info
View the source code on GitHub ButtonSpinner.cs
Have questions or feedback? Join the conversation below.