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 @@