Want to help
欢迎任何人士帮忙支持并让这个简单控件变得更好,我们需要你们。
welcome any one to help and make this simple control better, we need you.
VariableBox is an Avalonia Control for building cross-platform UIs with Avalonia UI.
Theme | Fluent | Semi |
---|---|---|
Dark | ![]() |
![]() |
Light | ![]() |
![]() |
-
2025/03/10(0.8.0)
- unify the semi NumericalBox and VariableBox
- Use MonoSpace etc. font by default
- Update readme for event and command
- Update demo for event and command
-
2025/02/25(0.7.0)
- Mass UI Polish
- Uniform the UI for each App Theme
- An new Spinner Theme for FluentTheme
- you can change the
NumericUpDown
Theme just likeVariableBox
- you can change the
-
2025/02/21(v0.6.0)
- unify the
tab
key focus behavior, only the text box and read write button can be focused - fix the enter key trigger behavior bug
- style polish, uniform the style of the button spinner and the disabled style
- demo update
- unify the
-
2025/02/20(v0.5.0)
- remote property
IsEnableEditingIndicator
indicator - please use the
PseudoClasses
:editing
for editing:invalid
for invalid input
- remote property
-
2025/02/19(v0.4.0)
- fix the style of buttonspinner and the disabled style
- fluent,semi and simple is all supported
- fix the style of buttonspinner and the disabled style
-
2025/1/21(v0.3.0)
- Add an overall border to create a more unified visual effect.
- other polish
-
2025/1/9 (v0.2.1)
- Using a theme pack that is compatible with
Simple
,Fluent
, andSemiThemes
. - Package Theme To the Control Package, You do not need another package anymore
- Using a theme pack that is compatible with
- all numerical type support
- spinning updown support
- get (read) /set (write) support
- rich formatting support like
hex
,dec
andbin
- drag support, you can use mouse to drag
- mouse scroll support
- shortcut and arrow key support
- Esc for cancel editing
- Enter for trigger
- up for increase
- down for decrease
- alt+left for read
- alt+right/alt+enterfor trigger (force) write
- identify support
*
for editing- red * for error input
- green * for right input
- compact mode
- boarder
Add nuget package:
dotnet add package VariableBox.Avalonia
You can now use VariableBox controls in your Avalonia Application.
<Window
...
xmlns:vbox="VariableBox"
...>
<StackPanel Margin="20">
<vbox:VariableBoxUInt Value="{Binding Value}"
FormatString="X8"
HeaderContent="0x"
ParsingNumberStyle="AllowHexSpecifier"
Step="2"
IsEnableEditingIndicator="True"
/>
</StackPanel>
</Window>
FYI, you can see demo.
we have Read and Write(ValueChenged)Event.
-
ValueChanged or you click write, you can get the old and new value
public event EventHandler<ValueChangedEventArgs<T>>? ValueChanged
-
ReadRequestedEvent When you Click Read,
you can update your value while reading and there is not valueChangeEvent
public event RoutedEvent<RoutedEventArgs> ReadRequestedEvent
-
HeaderDoubleTapedEvent When you Double the header
public static readonly RoutedEvent<TappedEventArgs> HeaderDoubleTapedEvent
-
Commnad
Value changed or click the writePlease don't set the CommandParater to Current Value, Like
CommandParameter="{Binding Value}"
will get you the old value- you can just binding with a command like
WriteCommnad(uint v)
, you don't need to set the Command parater by default - we will send the updated-value for you
- you can just binding with a command like
-
ReadCommand
When you click Readsame as
Commnad
, The default parameter will be the current value -
HeaderDoubleTapedCommand
when you double click the Header
//view
Command="{Binding TrythisCommand}"
ReadCommand="{Binding ReadDemoCommand}"
// viewmodel
[RelayCommand]
void Trythis(uint v)
{
CommandUpdateText =
$"Binding without CommandParater, and the default parameter will be the new value={v}";
}
// viewmodel
[RelayCommand]
void Trythis()
{
// also work too
}
// viewmodel
[RelayCommand]
void ReadDemo(uint v)
{
CommandUpdateText =
$"Binding without CommandParater,
and the default parameter will be the current value={v}";
}
// viewmodel
[RelayCommand]
void ReadDemo()
{
// also work too
}
CommandParameter="{Binding Value}"
will get you the old value
VariableBox is based vbox:NumericUpDown
:editing
for editing:invalid
for invalid input
e.g.:
<Style Selector="vbox|NumericUpDown:editing">
<Style Selector="^ /template/ TextBox#PART_TextBox">
<Setter Property="Foreground" Value="Green" />
</Style>
<Style Selector="^:invalid /template/ TextBox#PART_TextBox">
<Setter Property="Foreground" Value="Red" />
</Style>
</Style>
To make VariableBox controls show up in your application, you need to reference to a theme package designed for VariableBox.
YOU do not need any other VariableBox package now
-
vbox:FluentTheme
is compatible with<FluentTheme/>
-
vbox:SemiTheme
is a theme package for VariableBox inspired by Semi Design.you need to
add package Semi.Avalonia
first -
vbox:SimpleTheme
is compatible with<SimpleTheme/>
You can add it to your project by following steps.
- Add nuget package:
dotnet add package VariableBox.Avalonia
- Include Styles in application:
- FluentTheme
<Application...
xmlns:vbox="VariableBox"
....>
<Application.Styles>
<!-- set this theme -->
<vbox:FluentTheme Locale="zh-CN"/>
</Application.Styles>
- SimpleTheme
<Application...
xmlns:vbox="VariableBox"
....>
<Application.Styles>
<SimpleTheme/>
<vbox:SimpleTheme Locale="zh-CN"/>
</Application.Styles>
- SemiTheme
dotnet add package Semi.Avalonia
<Application...
xmlns:vbox="VariableBox"
....>
<Application.Styles>
<!-- if use semi -->
<semi:SemiTheme Locale="zh-CN"/>
<vbox:SemiTheme Locale="zh-CN"/>
</Application.Styles>
for FluentTheme
user, you can changed the ButtonSpinner
just like VariableBox
for example:
ButtonSpinner
<ButtonSpinner Content="10" Theme="{DynamicResource FluentButtonSpinner}" />
- Sys
NumericUpDown
<NumericUpDown InnerLeftContent="Theme" Value="2">
<NumericUpDown.Styles>
<Style Selector=":is(ButtonSpinner)">
<Setter Property="Theme" Value="{DynamicResource FluentButtonSpinner}" />
</Style>
</NumericUpDown.Styles>
</NumericUpDown>
<Style Selector="NumericUpDown /template/ :is(ButtonSpinner)">
<Setter Property="Theme" Value="{DynamicResource FluentButtonSpinner}" />
</Style>