diff --git a/demo/Ursa.Demo/Pages/NumericUpDownDemo.axaml b/demo/Ursa.Demo/Pages/NumericUpDownDemo.axaml index 77b0def..3ed9f60 100644 --- a/demo/Ursa.Demo/Pages/NumericUpDownDemo.axaml +++ b/demo/Ursa.Demo/Pages/NumericUpDownDemo.axaml @@ -6,10 +6,10 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:u="https://irihi.tech/ursa" xmlns:vm="using:Ursa.Demo.ViewModels" - x:DataType="vm:NumericUpDownDemoViewModel" - x:CompileBindings="True" d:DesignHeight="450" d:DesignWidth="800" + x:CompileBindings="True" + x:DataType="vm:NumericUpDownDemoViewModel" mc:Ignorable="d"> @@ -20,33 +20,35 @@ - - - - - - - + + + + + + + - - - + \ No newline at end of file diff --git a/demo/Ursa.Demo/ViewModels/NumericUpDownDemoViewModel.cs b/demo/Ursa.Demo/ViewModels/NumericUpDownDemoViewModel.cs index 9cf7651..c543bea 100644 --- a/demo/Ursa.Demo/ViewModels/NumericUpDownDemoViewModel.cs +++ b/demo/Ursa.Demo/ViewModels/NumericUpDownDemoViewModel.cs @@ -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);