adjust demo

This commit is contained in:
heartacker
2024-03-24 16:42:38 +08:00
parent be3c76c266
commit d6c0162253
2 changed files with 78 additions and 52 deletions

View File

@@ -11,6 +11,10 @@ namespace Ursa.Demo.ViewModels;
public partial class NumericUpDownDemoViewModel : ObservableObject
{
private double _oldWidth=300;
[ObservableProperty] private bool _AutoWidth = true;
[ObservableProperty] private double _Width = Double.NaN;
[ObservableProperty] private uint _Value;
[ObservableProperty] private string _FontFamily = "Consolas";
[ObservableProperty] private bool _AllowDrag = false;
@@ -42,6 +46,19 @@ public partial class NumericUpDownDemoViewModel : ObservableObject
}
partial void OnAutoWidthChanged(bool value)
{
if (value)
{
_oldWidth = Width;
Width = double.NaN;
}
else
{
Width = _oldWidth;
}
}
partial void OnValueChanging(uint oldValue, uint newValue)
{
Console.WriteLine(oldValue);