From c81951a262d9a3f1e7bd00bfb53e7c94ea905fc8 Mon Sep 17 00:00:00 2001 From: Corvin <43533385+corvinsz@users.noreply.github.com> Date: Mon, 14 Sep 2026 15:08:05 +0200 Subject: [PATCH] docs: rework NumericUpDown examples in demo apps --- src/MainDemo.Wpf/NumericUpDown.xaml | 55 ++++-------- src/MaterialDesign3.Demo.Wpf/App.xaml.cs | 7 +- .../Domain/MainWindowViewModel.cs | 13 +++ .../FieldsLineUp.xaml.cs | 2 +- .../NumericUpDown.xaml | 33 ++++++++ .../NumericUpDown.xaml.cs | 9 ++ .../NumericUpDown/BasicUsageExample.xaml | 46 ++++++++++ .../NumericUpDown/BasicUsageExample.xaml.cs | 9 ++ .../KeyboardAndScrollExample.xaml | 40 +++++++++ .../KeyboardAndScrollExample.xaml.cs | 9 ++ .../Examples/NumericUpDown/MinMaxExample.xaml | 32 +++++++ .../NumericUpDown/MinMaxExample.xaml.cs | 9 ++ .../NumericUpDown/OverrideButtonsExample.xaml | 57 +++++++++++++ .../OverrideButtonsExample.xaml.cs | 9 ++ .../NumericUpDown/TypesTableExample.xaml | 83 +++++++++++++++++++ .../NumericUpDown/TypesTableExample.xaml.cs | 9 ++ .../NumericUpDown/ValueStepExample.xaml | 44 ++++++++++ .../NumericUpDown/ValueStepExample.xaml.cs | 9 ++ 18 files changed, 432 insertions(+), 43 deletions(-) create mode 100644 src/MaterialDesign3.Demo.Wpf/NumericUpDown.xaml create mode 100644 src/MaterialDesign3.Demo.Wpf/NumericUpDown.xaml.cs create mode 100644 src/MaterialDesignDemo.Shared/Examples/NumericUpDown/BasicUsageExample.xaml create mode 100644 src/MaterialDesignDemo.Shared/Examples/NumericUpDown/BasicUsageExample.xaml.cs create mode 100644 src/MaterialDesignDemo.Shared/Examples/NumericUpDown/KeyboardAndScrollExample.xaml create mode 100644 src/MaterialDesignDemo.Shared/Examples/NumericUpDown/KeyboardAndScrollExample.xaml.cs create mode 100644 src/MaterialDesignDemo.Shared/Examples/NumericUpDown/MinMaxExample.xaml create mode 100644 src/MaterialDesignDemo.Shared/Examples/NumericUpDown/MinMaxExample.xaml.cs create mode 100644 src/MaterialDesignDemo.Shared/Examples/NumericUpDown/OverrideButtonsExample.xaml create mode 100644 src/MaterialDesignDemo.Shared/Examples/NumericUpDown/OverrideButtonsExample.xaml.cs create mode 100644 src/MaterialDesignDemo.Shared/Examples/NumericUpDown/TypesTableExample.xaml create mode 100644 src/MaterialDesignDemo.Shared/Examples/NumericUpDown/TypesTableExample.xaml.cs create mode 100644 src/MaterialDesignDemo.Shared/Examples/NumericUpDown/ValueStepExample.xaml create mode 100644 src/MaterialDesignDemo.Shared/Examples/NumericUpDown/ValueStepExample.xaml.cs diff --git a/src/MainDemo.Wpf/NumericUpDown.xaml b/src/MainDemo.Wpf/NumericUpDown.xaml index ec43eda214..2881717e04 100644 --- a/src/MainDemo.Wpf/NumericUpDown.xaml +++ b/src/MainDemo.Wpf/NumericUpDown.xaml @@ -4,6 +4,7 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:sharedNum="clr-namespace:MaterialDesignDemo.Shared.Examples.NumericUpDown;assembly=MaterialDesignDemo.Shared" xmlns:smtx="clr-namespace:ShowMeTheXAML;assembly=ShowMeTheXAML" d:DesignHeight="800" d:DesignWidth="1000" @@ -17,45 +18,19 @@ - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + diff --git a/src/MaterialDesign3.Demo.Wpf/App.xaml.cs b/src/MaterialDesign3.Demo.Wpf/App.xaml.cs index 9850703b17..ccf2f3c9bf 100644 --- a/src/MaterialDesign3.Demo.Wpf/App.xaml.cs +++ b/src/MaterialDesign3.Demo.Wpf/App.xaml.cs @@ -1,4 +1,5 @@ -using MaterialDesign.Shared; +using System.Reflection; +using MaterialDesign.Shared; using MaterialDesignThemes.Wpf; using ShowMeTheXAML; @@ -32,7 +33,9 @@ protected override void OnStartup(StartupEventArgs e) XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag))); */ - XamlDisplay.Init(); + var sharedAssembly + = Assembly.GetAssembly(typeof(MaterialDesignDemo.Shared.IMaterialDesignDemoSharedAssemblyMarker)); + XamlDisplay.Init(sharedAssembly); // test setup for Persian culture settings /*System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("fa-Ir"); diff --git a/src/MaterialDesign3.Demo.Wpf/Domain/MainWindowViewModel.cs b/src/MaterialDesign3.Demo.Wpf/Domain/MainWindowViewModel.cs index 9096519557..526947a680 100644 --- a/src/MaterialDesign3.Demo.Wpf/Domain/MainWindowViewModel.cs +++ b/src/MaterialDesign3.Demo.Wpf/Domain/MainWindowViewModel.cs @@ -491,6 +491,19 @@ private static IEnumerable GenerateDemoItems(ISnackbarMessageQueue sna ], selectedIcon: PackIconKind.Tooltip, unselectedIcon: PackIconKind.Tooltip); + + yield return new DemoItem( + nameof(NumericUpDown), + typeof(NumericUpDown), + [ + DocumentationLink.DemoPageLink(), + DocumentationLink.StyleLink(nameof(NumericUpDown)), + DocumentationLink.ApiLink(), + DocumentationLink.ApiLink(), + DocumentationLink.ApiLink() + ], + selectedIcon: PackIconKind.Counter, + unselectedIcon: PackIconKind.Counter); } private bool DemoItemsFilter(object obj) diff --git a/src/MaterialDesign3.Demo.Wpf/FieldsLineUp.xaml.cs b/src/MaterialDesign3.Demo.Wpf/FieldsLineUp.xaml.cs index 094f7c70c6..9f94e5aded 100644 --- a/src/MaterialDesign3.Demo.Wpf/FieldsLineUp.xaml.cs +++ b/src/MaterialDesign3.Demo.Wpf/FieldsLineUp.xaml.cs @@ -95,7 +95,7 @@ private static void SetValue(Control control) case TimePicker timePicker: timePicker.SelectedTime = DateTime.Now; break; - case NumericUpDown numericUpDown: + case MaterialDesignThemes.Wpf.NumericUpDown numericUpDown: numericUpDown.Value = 0; break; default: diff --git a/src/MaterialDesign3.Demo.Wpf/NumericUpDown.xaml b/src/MaterialDesign3.Demo.Wpf/NumericUpDown.xaml new file mode 100644 index 0000000000..b27fd5e3ab --- /dev/null +++ b/src/MaterialDesign3.Demo.Wpf/NumericUpDown.xaml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/MaterialDesign3.Demo.Wpf/NumericUpDown.xaml.cs b/src/MaterialDesign3.Demo.Wpf/NumericUpDown.xaml.cs new file mode 100644 index 0000000000..f4c2229bb9 --- /dev/null +++ b/src/MaterialDesign3.Demo.Wpf/NumericUpDown.xaml.cs @@ -0,0 +1,9 @@ +namespace MaterialDesign3Demo; + +public partial class NumericUpDown : UserControl +{ + public NumericUpDown() + { + InitializeComponent(); + } +} diff --git a/src/MaterialDesignDemo.Shared/Examples/NumericUpDown/BasicUsageExample.xaml b/src/MaterialDesignDemo.Shared/Examples/NumericUpDown/BasicUsageExample.xaml new file mode 100644 index 0000000000..3546f0b028 --- /dev/null +++ b/src/MaterialDesignDemo.Shared/Examples/NumericUpDown/BasicUsageExample.xaml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/MaterialDesignDemo.Shared/Examples/NumericUpDown/BasicUsageExample.xaml.cs b/src/MaterialDesignDemo.Shared/Examples/NumericUpDown/BasicUsageExample.xaml.cs new file mode 100644 index 0000000000..88b6e59914 --- /dev/null +++ b/src/MaterialDesignDemo.Shared/Examples/NumericUpDown/BasicUsageExample.xaml.cs @@ -0,0 +1,9 @@ +namespace MaterialDesignDemo.Shared.Examples.NumericUpDown; + +public partial class BasicUsageExample : UserControl +{ + public BasicUsageExample() + { + InitializeComponent(); + } +} diff --git a/src/MaterialDesignDemo.Shared/Examples/NumericUpDown/KeyboardAndScrollExample.xaml b/src/MaterialDesignDemo.Shared/Examples/NumericUpDown/KeyboardAndScrollExample.xaml new file mode 100644 index 0000000000..1f77e94bd4 --- /dev/null +++ b/src/MaterialDesignDemo.Shared/Examples/NumericUpDown/KeyboardAndScrollExample.xaml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/MaterialDesignDemo.Shared/Examples/NumericUpDown/KeyboardAndScrollExample.xaml.cs b/src/MaterialDesignDemo.Shared/Examples/NumericUpDown/KeyboardAndScrollExample.xaml.cs new file mode 100644 index 0000000000..6754dacaa8 --- /dev/null +++ b/src/MaterialDesignDemo.Shared/Examples/NumericUpDown/KeyboardAndScrollExample.xaml.cs @@ -0,0 +1,9 @@ +namespace MaterialDesignDemo.Shared.Examples.NumericUpDown; + +public partial class KeyboardAndScrollExample : UserControl +{ + public KeyboardAndScrollExample() + { + InitializeComponent(); + } +} diff --git a/src/MaterialDesignDemo.Shared/Examples/NumericUpDown/MinMaxExample.xaml b/src/MaterialDesignDemo.Shared/Examples/NumericUpDown/MinMaxExample.xaml new file mode 100644 index 0000000000..142414fc1a --- /dev/null +++ b/src/MaterialDesignDemo.Shared/Examples/NumericUpDown/MinMaxExample.xaml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + diff --git a/src/MaterialDesignDemo.Shared/Examples/NumericUpDown/MinMaxExample.xaml.cs b/src/MaterialDesignDemo.Shared/Examples/NumericUpDown/MinMaxExample.xaml.cs new file mode 100644 index 0000000000..738a38b1bf --- /dev/null +++ b/src/MaterialDesignDemo.Shared/Examples/NumericUpDown/MinMaxExample.xaml.cs @@ -0,0 +1,9 @@ +namespace MaterialDesignDemo.Shared.Examples.NumericUpDown; + +public partial class MinMaxExample : UserControl +{ + public MinMaxExample() + { + InitializeComponent(); + } +} diff --git a/src/MaterialDesignDemo.Shared/Examples/NumericUpDown/OverrideButtonsExample.xaml b/src/MaterialDesignDemo.Shared/Examples/NumericUpDown/OverrideButtonsExample.xaml new file mode 100644 index 0000000000..1c3663cd57 --- /dev/null +++ b/src/MaterialDesignDemo.Shared/Examples/NumericUpDown/OverrideButtonsExample.xaml @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/MaterialDesignDemo.Shared/Examples/NumericUpDown/OverrideButtonsExample.xaml.cs b/src/MaterialDesignDemo.Shared/Examples/NumericUpDown/OverrideButtonsExample.xaml.cs new file mode 100644 index 0000000000..5a613e46fd --- /dev/null +++ b/src/MaterialDesignDemo.Shared/Examples/NumericUpDown/OverrideButtonsExample.xaml.cs @@ -0,0 +1,9 @@ +namespace MaterialDesignDemo.Shared.Examples.NumericUpDown; + +public partial class OverrideButtonsExample : UserControl +{ + public OverrideButtonsExample() + { + InitializeComponent(); + } +} diff --git a/src/MaterialDesignDemo.Shared/Examples/NumericUpDown/TypesTableExample.xaml b/src/MaterialDesignDemo.Shared/Examples/NumericUpDown/TypesTableExample.xaml new file mode 100644 index 0000000000..5bf3e45937 --- /dev/null +++ b/src/MaterialDesignDemo.Shared/Examples/NumericUpDown/TypesTableExample.xaml @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/MaterialDesignDemo.Shared/Examples/NumericUpDown/TypesTableExample.xaml.cs b/src/MaterialDesignDemo.Shared/Examples/NumericUpDown/TypesTableExample.xaml.cs new file mode 100644 index 0000000000..8a79fac162 --- /dev/null +++ b/src/MaterialDesignDemo.Shared/Examples/NumericUpDown/TypesTableExample.xaml.cs @@ -0,0 +1,9 @@ +namespace MaterialDesignDemo.Shared.Examples.NumericUpDown; + +public partial class TypesTableExample : UserControl +{ + public TypesTableExample() + { + InitializeComponent(); + } +} diff --git a/src/MaterialDesignDemo.Shared/Examples/NumericUpDown/ValueStepExample.xaml b/src/MaterialDesignDemo.Shared/Examples/NumericUpDown/ValueStepExample.xaml new file mode 100644 index 0000000000..39a347d5cd --- /dev/null +++ b/src/MaterialDesignDemo.Shared/Examples/NumericUpDown/ValueStepExample.xaml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/MaterialDesignDemo.Shared/Examples/NumericUpDown/ValueStepExample.xaml.cs b/src/MaterialDesignDemo.Shared/Examples/NumericUpDown/ValueStepExample.xaml.cs new file mode 100644 index 0000000000..8246978ff0 --- /dev/null +++ b/src/MaterialDesignDemo.Shared/Examples/NumericUpDown/ValueStepExample.xaml.cs @@ -0,0 +1,9 @@ +namespace MaterialDesignDemo.Shared.Examples.NumericUpDown; + +public partial class ValueStepExample : UserControl +{ + public ValueStepExample() + { + InitializeComponent(); + } +}