From 7943fba9fe6afc0bb15c92bf54ecc702808b4918 Mon Sep 17 00:00:00 2001 From: Peter Date: Sat, 15 Jun 2024 00:46:54 +0800 Subject: [PATCH 1/2] Fix: NumberBox Code binding --- WinUIGallery/ControlPages/NumberBoxPage.xaml | 12 ++++++++--- .../ControlPages/NumberBoxPage.xaml.cs | 21 +++++++------------ .../NumberBox/NumberBoxSample2_xaml.txt | 2 +- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/WinUIGallery/ControlPages/NumberBoxPage.xaml b/WinUIGallery/ControlPages/NumberBoxPage.xaml index a3eeb8289..b948098aa 100644 --- a/WinUIGallery/ControlPages/NumberBoxPage.xaml +++ b/WinUIGallery/ControlPages/NumberBoxPage.xaml @@ -44,11 +44,17 @@ - - - + + + Inline + Compact + + + + \ No newline at end of file From e7a8e006897a3d7b3d26c25401ec054db6f1b278 Mon Sep 17 00:00:00 2001 From: Peter Date: Sat, 15 Jun 2024 01:03:06 +0800 Subject: [PATCH 2/2] Add binding for EasingFunction --- .../ControlPages/EasingFunctionPage.xaml | 7 ++++--- WinUIGallery/ControlPages/NumberBoxPage.xaml | 11 ++++------ .../ControlPages/NumberBoxPage.xaml.cs | 21 ++++++++++++------- 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/WinUIGallery/ControlPages/EasingFunctionPage.xaml b/WinUIGallery/ControlPages/EasingFunctionPage.xaml index 796b790e5..a5c6dd3ce 100644 --- a/WinUIGallery/ControlPages/EasingFunctionPage.xaml +++ b/WinUIGallery/ControlPages/EasingFunctionPage.xaml @@ -144,8 +144,8 @@ - - + + @@ -177,7 +177,7 @@ <Storyboard x:Name="Storyboard3"> <DoubleAnimation Storyboard.TargetName="Translation" Storyboard.TargetProperty="X" From="0" To="200" > <DoubleAnimation.EasingFunction> - <$(EasingFunction)/> + <$(EasingFunction) EasingMode="$(EasingMode)"/> </DoubleAnimation.EasingFunction> </DoubleAnimation> </Storyboard> @@ -185,6 +185,7 @@ + diff --git a/WinUIGallery/ControlPages/NumberBoxPage.xaml b/WinUIGallery/ControlPages/NumberBoxPage.xaml index b948098aa..6717a9234 100644 --- a/WinUIGallery/ControlPages/NumberBoxPage.xaml +++ b/WinUIGallery/ControlPages/NumberBoxPage.xaml @@ -44,16 +44,13 @@ - - - Inline - Compact + + + - - + diff --git a/WinUIGallery/ControlPages/NumberBoxPage.xaml.cs b/WinUIGallery/ControlPages/NumberBoxPage.xaml.cs index 5c097054c..2f98e245a 100644 --- a/WinUIGallery/ControlPages/NumberBoxPage.xaml.cs +++ b/WinUIGallery/ControlPages/NumberBoxPage.xaml.cs @@ -38,16 +38,21 @@ private void SetNumberBoxNumberFormatter() FormattedNumberBox.NumberFormatter = formatter; } - private void SpinButtonPlacementGroup_SelectionChanged(object sender, SelectionChangedEventArgs e) + private void RadioButton_Checked(object sender, RoutedEventArgs e) { - switch(SpinButtonPlacementGroup.SelectedItem as string) + if (sender is RadioButton rb && NumberBoxSpinButtonPlacementExample != null) { - case "Inline": - NumberBoxSpinButtonPlacementExample.SpinButtonPlacementMode = NumberBoxSpinButtonPlacementMode.Inline; - break; - case "Compact": - NumberBoxSpinButtonPlacementExample.SpinButtonPlacementMode = NumberBoxSpinButtonPlacementMode.Compact; - break; + string spinButtonPlacementModeName = rb.Tag.ToString(); + + switch (spinButtonPlacementModeName) + { + case "Inline": + NumberBoxSpinButtonPlacementExample.SpinButtonPlacementMode = NumberBoxSpinButtonPlacementMode.Inline; + break; + case "Compact": + NumberBoxSpinButtonPlacementExample.SpinButtonPlacementMode = NumberBoxSpinButtonPlacementMode.Compact; + break; + } } } }