@@ -33,6 +33,12 @@ VariableBox is an Avalonia Control for building cross-platform UIs with Avalonia
3333| Light | ![ lf] ( https://github.com/heartacker/VariableBox.Avalonia/blob/main/assets/light-fluent.png ) | ![ ls] ( https://github.com/heartacker/VariableBox.Avalonia/blob/main/assets/light-semi.png ) |
3434
3535## ChangeLog
36+ - 2025/03/10(0.8.0)
37+ - unify the semi NumericalBox and VariableBox
38+ - Use MonoSpace etc. font by default
39+ - Update readme for event and command
40+ - Update demo for event and command
41+
3642- 2025/02/25(0.7.0)
3743 - Mass UI Polish
3844 - Uniform the UI for each App Theme
@@ -108,7 +114,7 @@ You can now use VariableBox controls in your Avalonia Application.
108114 xmlns : vbox =" VariableBox"
109115 ...>
110116 <StackPanel Margin =" 20" >
111- <vbox : VariableBoxUInt Value =" {Binding Value}"
117+ <vbox : VariableBoxUInt Value =" {Binding Value}"
112118 FormatString =" X8"
113119 HeaderContent =" 0x"
114120 ParsingNumberStyle =" AllowHexSpecifier"
@@ -119,16 +125,97 @@ You can now use VariableBox controls in your Avalonia Application.
119125</Window >
120126```
121127
128+ ### CommandS and Events
129+
130+ FYI, you can see demo.
131+
132+ #### Event
133+
134+ we have Read and Write(ValueChenged)Event.
135+
136+ - ** ValueChanged** or you click write, you can get the old and new value
137+
138+ ` public event EventHandler<ValueChangedEventArgs<T>>? ValueChanged `
139+
140+ - ** ReadRequestedEvent** When you Click Read,
141+ > ** you can update your value while reading and there is not valueChangeEvent**
142+
143+ ` public event RoutedEvent<RoutedEventArgs> ReadRequestedEvent `
144+
145+ - ** HeaderDoubleTapedEvent** When you Double the header
146+
147+ ` public static readonly RoutedEvent<TappedEventArgs> HeaderDoubleTapedEvent `
148+
149+ #### Command for MVVM
150+
151+ - ` Commnad ` Value changed or click the write
152+ > ** Please don't set the CommandParater to Current Value, Like ` CommandParameter="{Binding Value}" ` will get you the old value**
153+
154+ 1 . you can just binding with a command like ` WriteCommnad(uint v) ` , ** you don't need to set the Command parater by default**
155+ 2 . we will send the updated-value for you
156+
157+ - ` ReadCommand ` When you click Read
158+
159+ same as ` Commnad ` , The default parameter will be the ** current value**
160+
161+ - ` HeaderDoubleTapedCommand ` when you double click the Header
162+
163+ #### Demo
164+
165+ ``` csharp
166+ // view
167+ Command = " {Binding TrythisCommand}"
168+ ReadCommand = " {Binding ReadDemoCommand}"
169+
170+ // viewmodel
171+ [RelayCommand ]
172+ void Trythis (uint v )
173+ {
174+ CommandUpdateText =
175+ $" Binding without CommandParater, and the default parameter will be the new value={v }" ;
176+ }
177+
178+ // viewmodel
179+ [RelayCommand ]
180+ void Trythis ()
181+ {
182+ // also work too
183+ }
184+
185+ // viewmodel
186+ [RelayCommand ]
187+ void ReadDemo (uint v )
188+ {
189+ CommandUpdateText =
190+ $" Binding without CommandParater,
191+ and the default parameter will be the current value = {v }" ;
192+ }
193+
194+ // viewmodel
195+ [RelayCommand ]
196+ void ReadDemo ()
197+ {
198+ // also work too
199+ }
200+
201+ ```
202+
203+ #### Note for command
204+
205+ - `CommandParameter = " {Binding Value}" ` will get you the old value
206+
122207### PseudoClasses
123208
209+ > VariableBox is based vbox : NumericUpDown
210+
124211- `: editing ` for editing
125212- `: invalid ` for invalid input
126213
127214e .g .:
128215
129216< div style = " display: flex;" >
130217 < div style = " flex: 50%; padding: 2px;" >
131-
218+
132219
133220```xml
134221< Style Selector = " vbox|NumericUpDown:editing" >
@@ -209,7 +296,7 @@ dotnet add package Semi.Avalonia
209296 xmlns:vbox="VariableBox"
210297 ....>
211298 <Application.Styles>
212- <!-- if use semi -->
299+ <!-- if use semi -->
213300 <semi:SemiTheme Locale="zh-CN"/>
214301 <vbox:SemiTheme Locale="zh-CN"/>
215302 </Application.Styles>
0 commit comments