diff --git a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/NumericUpDownDemoCtl.xaml b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/NumericUpDownDemoCtl.xaml
index 433afce9..e09deb85 100644
--- a/src/Shared/HandyControlDemo_Shared/UserControl/Controls/NumericUpDownDemoCtl.xaml
+++ b/src/Shared/HandyControlDemo_Shared/UserControl/Controls/NumericUpDownDemoCtl.xaml
@@ -15,13 +15,7 @@
-
-
+
diff --git a/src/Shared/HandyControl_Shared/Controls/Input/NumericUpDown.cs b/src/Shared/HandyControl_Shared/Controls/Input/NumericUpDown.cs
index d2e4dbd4..cc544656 100644
--- a/src/Shared/HandyControl_Shared/Controls/Input/NumericUpDown.cs
+++ b/src/Shared/HandyControl_Shared/Controls/Input/NumericUpDown.cs
@@ -153,21 +153,11 @@ namespace HandyControl.Controls
}
}
- private string CurrentText
- {
- get
- {
- if (string.IsNullOrWhiteSpace(StringFormat))
- {
- return DecimalPlaces.HasValue ? Value.ToString($"#0.{new string('0', DecimalPlaces.Value)}") :
- Value.ToString("#0");
- }
- else
- {
- return Value.ToString(StringFormat);
- }
- }
- }
+ private string CurrentText => string.IsNullOrWhiteSpace(ValueFormat)
+ ? DecimalPlaces.HasValue
+ ? Value.ToString($"#0.{new string('0', DecimalPlaces.Value)}")
+ : Value.ToString("#0")
+ : Value.ToString(ValueFormat);
protected virtual void OnValueChanged(FunctionEventArgs e) => RaiseEvent(e);
@@ -333,16 +323,16 @@ namespace HandyControl.Controls
///
/// 指示要显示的数字的格式
///
- public static readonly DependencyProperty StringFormatProperty =
- DependencyProperty.Register("StringFormat", typeof(string), typeof(NumericUpDown), new PropertyMetadata(default(string)));
+ public static readonly DependencyProperty ValueFormatProperty = DependencyProperty.Register(
+ "ValueFormat", typeof(string), typeof(NumericUpDown), new PropertyMetadata(default(string)));
///
/// 指示要显示的数字的格式,这将会覆盖 属性
///
- public string StringFormat
+ public string ValueFormat
{
- get { return (string)GetValue(StringFormatProperty); }
- set { SetValue(StringFormatProperty, value); }
+ get => (string) GetValue(ValueFormatProperty);
+ set => SetValue(ValueFormatProperty, value);
}
///