VariableBox.Avalonia 0.8.0

dotnet add package VariableBox.Avalonia --version 0.8.0                
NuGet\Install-Package VariableBox.Avalonia -Version 0.8.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="VariableBox.Avalonia" Version="0.8.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add VariableBox.Avalonia --version 0.8.0                
#r "nuget: VariableBox.Avalonia, 0.8.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install VariableBox.Avalonia as a Cake Addin
#addin nuget:?package=VariableBox.Avalonia&version=0.8.0

// Install VariableBox.Avalonia as a Cake Tool
#tool nuget:?package=VariableBox.Avalonia&version=0.8.0                

VariableBox

<p align="center">

Want to help

欢迎任何人士帮忙支持并让这个简单控件变得更好,我们需要你们。

welcome any one to help and make this simple control better, we need you.

</p>

GitHub stars GitHub release Nuget Nuget

<p align="center"> <img src="Logo.svg" alt="drawing" width="150" /> </p>

<p align="center">

Alt

</p>

VariableBox is an Avalonia Control for building cross-platform UIs with Avalonia UI.

Theme Fluent Semi
Dark df ds
Light lf ls

ChangeLog

  • 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 like VariableBox
  • 2025/02/21(v0.6.0)

    1. unify the tab key focus behavior, only the text box and read write button can be focused
    2. fix the enter key trigger behavior bug
    3. style polish, uniform the style of the button spinner and the disabled style
    4. demo update
  • 2025/02/20(v0.5.0)

    1. remote property IsEnableEditingIndicator indicator
    2. please use the PseudoClasses
      1. :editing for editing
      2. :invalid for invalid input
  • 2025/02/19(v0.4.0)

    1. fix the style of buttonspinner and the disabled style
      1. fluent,semi and simple is all supported
  • 2025/1/21(v0.3.0)

    1. Add an overall border to create a more unified visual effect.
    2. other polish
  • 2025/1/9 (v0.2.1)

    1. Using a theme pack that is compatible with Simple, Fluent, and SemiThemes.
    2. Package Theme To the Control Package, You do not need another package anymore

Feature

NumericalUpDown

  • all numerical type support
  • spinning updown support
  • get (read) /set (write) support
  • rich formatting support like hex, dec and bin
  • drag support, you can use mouse to drag
  • mouse scroll support
  • shortcut and arrow key support
    • <kbd>Esc</kbd> for cancel editing
    • <kbd>Enter</kbd> for trigger
    • <kbd>up</kbd> for increase
    • <kbd>down</kbd> for decrease
    • <kbd>alt+left</kbd> for read
    • <kbd>alt+right</kbd>/<kbd>alt+enter</kbd>for trigger (force) write
  • identify support
    • * for editing
    • red <font color=red>*</font> for error input
    • green <font color=green>*</font> for right input

EnumerationUpDown

  • compact mode
  • boarder

How to use

VariableBox

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>

CommandS and Events

FYI, you can see demo.

Event

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

Command for MVVM
  • Commnad Value changed or click the write

    Please don't set the CommandParater to Current Value, Like CommandParameter="{Binding Value}" will get you the old value

    1. you can just binding with a command like WriteCommnad(uint v), you don't need to set the Command parater by default
    2. we will send the updated-value for you
  • ReadCommand When you click Read

    same as Commnad, The default parameter will be the current value

  • HeaderDoubleTapedCommand when you double click the Header

Demo
//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
}

Note for command
  • CommandParameter="{Binding Value}" will get you the old value

PseudoClasses

VariableBox is based vbox:NumericUpDown

  • :editing for editing
  • :invalid for invalid input

e.g.:

<div style="display: flex;"> <div style="flex: 50%; padding: 2px;">

<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>

</div>

<div style="flex: 20%; padding: 2px;">

pseudoclass

</div> </div>

VariableBox.Themes

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.

  1. Add nuget package:
dotnet add package VariableBox.Avalonia
  1. Include Styles in application:
  • FluentTheme
<Application...
    xmlns:vbox="VariableBox"
    ....>
    <Application.Styles>
        
        <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>
        
        <semi:SemiTheme Locale="zh-CN"/>
        <vbox:SemiTheme Locale="zh-CN"/>
    </Application.Styles>
Additional Theme for Fluent ButtonSpinner

for FluentTheme user, you can changed the ButtonSpinner just like VariableBox

FluentButtonSpinner

for example:

  1. ButtonSpinner
<ButtonSpinner Content="10" Theme="{DynamicResource FluentButtonSpinner}" />
  1. 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>
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on VariableBox.Avalonia:

Package Downloads
VariableBox.Avalonia.Themes.Semi

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.8.0 176 10 days ago
0.7.0 118 23 days ago
0.6.0 109 a month ago 0.6.0 is deprecated because it is no longer maintained.
0.5.0 106 a month ago 0.5.0 is deprecated because it is no longer maintained and has critical bugs.
0.4.1 103 a month ago 0.4.1 is deprecated because it is no longer maintained.
0.4.0 116 a month ago 0.4.0 is deprecated because it is no longer maintained.
0.3.0 184 2 months ago 0.3.0 is deprecated because it is no longer maintained.
0.2.1 117 2 months ago 0.2.1 is deprecated because it is no longer maintained.
0.2.0 99 2 months ago 0.2.0 is deprecated because it is no longer maintained.
0.1.2-beta20250109 66 2 months ago 0.1.2-beta20250109 is deprecated because it is no longer maintained.
0.1.1-beta20250106 98 2 months ago 0.1.1-beta20250106 is deprecated because it is no longer maintained and has critical bugs.
0.1.0-beta20250103 124 3 months ago 0.1.0-beta20250103 is deprecated because it has critical bugs.
0.0.5-beta20240803 319 8 months ago 0.0.5-beta20240803 is deprecated because it has critical bugs.
0.0.4-beta20240604 172 10 months ago 0.0.4-beta20240604 is deprecated because it has critical bugs.
0.0.3-beta202404081 198 4/8/2024 0.0.3-beta202404081 is deprecated because it has critical bugs.
0.0.3-beta20240408 108 4/7/2024 0.0.3-beta20240408 is deprecated because it is no longer maintained.
0.0.3-beta20240407 104 4/7/2024 0.0.3-beta20240407 is deprecated because it is no longer maintained.
0.0.2-beta20240407 103 4/7/2024 0.0.2-beta20240407 is deprecated because it is no longer maintained.
0.0.1-beta20240406 105 4/6/2024 0.0.1-beta20240406 is deprecated because it is no longer maintained.
0.0.1-beta20240404 102 4/3/2024 0.0.1-beta20240404 is deprecated because it has critical bugs.