From 5629ecfbeb0dafeade6670d0401f8dd4a24bea63 Mon Sep 17 00:00:00 2001
From: Corvin <43533385+corvinsz@users.noreply.github.com>
Date: Thu, 8 Oct 2026 16:39:27 +0200
Subject: [PATCH] feat(NumericUpDown): add DoubleUpDown and LongUpDown controls
---
.../NumericUpDown/TypesTableExample.xaml | 49 +++++++++++++++++++
src/MaterialDesignThemes.Wpf/DoubleUpDown.cs | 42 ++++++++++++++++
src/MaterialDesignThemes.Wpf/LongUpDown.cs | 42 ++++++++++++++++
.../Themes/Generic.xaml | 2 +
.../MaterialDesignTheme.NumericUpDown.xaml | 24 +++++++++
.../VisualStudioToolsManifest.xml | 2 +
6 files changed, 161 insertions(+)
create mode 100644 src/MaterialDesignThemes.Wpf/DoubleUpDown.cs
create mode 100644 src/MaterialDesignThemes.Wpf/LongUpDown.cs
diff --git a/src/MaterialDesignDemo.Shared/Examples/NumericUpDown/TypesTableExample.xaml b/src/MaterialDesignDemo.Shared/Examples/NumericUpDown/TypesTableExample.xaml
index efac3ac350..89d61d0910 100644
--- a/src/MaterialDesignDemo.Shared/Examples/NumericUpDown/TypesTableExample.xaml
+++ b/src/MaterialDesignDemo.Shared/Examples/NumericUpDown/TypesTableExample.xaml
@@ -24,8 +24,11 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/MaterialDesignThemes.Wpf/DoubleUpDown.cs b/src/MaterialDesignThemes.Wpf/DoubleUpDown.cs
new file mode 100644
index 0000000000..506d9a3808
--- /dev/null
+++ b/src/MaterialDesignThemes.Wpf/DoubleUpDown.cs
@@ -0,0 +1,42 @@
+#if !NET8_0_OR_GREATER
+using System.Globalization;
+#endif
+
+namespace MaterialDesignThemes.Wpf;
+
+public class DoubleUpDown
+#if NET8_0_OR_GREATER
+ : UpDownBase
+#else
+ : UpDownBase
+#endif
+{
+ static DoubleUpDown()
+ {
+ DefaultStyleKeyProperty.OverrideMetadata(typeof(DoubleUpDown), new FrameworkPropertyMetadata(typeof(DoubleUpDown)));
+ }
+}
+
+#if !NET8_0_OR_GREATER
+public class DoubleArithmetic : IArithmetic
+{
+ public double Add(double value1, double value2) => value1 + value2;
+
+ public double Subtract(double value1, double value2) => value1 - value2;
+
+ public int Compare(double value1, double value2) => value1.CompareTo(value2);
+
+ public double MinValue() => double.MinValue;
+
+ public double MaxValue() => double.MaxValue;
+
+ public double One() => 1d;
+
+ public double Max(double value1, double value2) => Math.Max(value1, value2);
+
+ public double Min(double value1, double value2) => Math.Min(value1, value2);
+
+ public bool TryParse(string text, IFormatProvider? formatProvider, out double value)
+ => double.TryParse(text, NumberStyles.Number, formatProvider, out value);
+}
+#endif
diff --git a/src/MaterialDesignThemes.Wpf/LongUpDown.cs b/src/MaterialDesignThemes.Wpf/LongUpDown.cs
new file mode 100644
index 0000000000..51a1bc641b
--- /dev/null
+++ b/src/MaterialDesignThemes.Wpf/LongUpDown.cs
@@ -0,0 +1,42 @@
+#if !NET8_0_OR_GREATER
+using System.Globalization;
+#endif
+
+namespace MaterialDesignThemes.Wpf;
+
+public class LongUpDown
+#if NET8_0_OR_GREATER
+ : UpDownBase
+#else
+ : UpDownBase
+#endif
+{
+ static LongUpDown()
+ {
+ DefaultStyleKeyProperty.OverrideMetadata(typeof(LongUpDown), new FrameworkPropertyMetadata(typeof(LongUpDown)));
+ }
+}
+
+#if !NET8_0_OR_GREATER
+public class LongArithmetic : IArithmetic
+{
+ public long Add(long value1, long value2) => value1 + value2;
+
+ public long Subtract(long value1, long value2) => value1 - value2;
+
+ public int Compare(long value1, long value2) => value1.CompareTo(value2);
+
+ public long MinValue() => long.MinValue;
+
+ public long MaxValue() => long.MaxValue;
+
+ public long One() => 1L;
+
+ public long Max(long value1, long value2) => Math.Max(value1, value2);
+
+ public long Min(long value1, long value2) => Math.Min(value1, value2);
+
+ public bool TryParse(string text, IFormatProvider? formatProvider, out long value)
+ => long.TryParse(text, NumberStyles.Integer, formatProvider, out value);
+}
+#endif
diff --git a/src/MaterialDesignThemes.Wpf/Themes/Generic.xaml b/src/MaterialDesignThemes.Wpf/Themes/Generic.xaml
index c11ba868e9..daddfd956f 100644
--- a/src/MaterialDesignThemes.Wpf/Themes/Generic.xaml
+++ b/src/MaterialDesignThemes.Wpf/Themes/Generic.xaml
@@ -44,6 +44,8 @@
+
+
True
diff --git a/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.NumericUpDown.xaml b/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.NumericUpDown.xaml
index ce0acb9a2b..7f3ec12a90 100644
--- a/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.NumericUpDown.xaml
+++ b/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.NumericUpDown.xaml
@@ -181,6 +181,14 @@
TargetType="{x:Type wpf:DecimalUpDown}"
BasedOn="{StaticResource MaterialDesignFloatingHintUpDownBase}" />
+
+
+
+