Skip to content

Commit c2c8793

Browse files
Use CultureInfo.CurrentCulture for string conversions of Value (#3860)
1 parent e7bc4d3 commit c2c8793

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/MaterialDesignThemes.Wpf/UpDownBase.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ private static void OnNumericValueChanged(DependencyObject d, DependencyProperty
118118

119119
if (upDownBase._textBoxField is { } textBox)
120120
{
121-
textBox.Text = e.NewValue.ToString();
121+
textBox.Text = Convert.ToString(e.NewValue, CultureInfo.CurrentCulture);
122122
}
123123

124124
upDownBase.UpdateDecreaseButtonEnabled();
@@ -224,7 +224,7 @@ public override void OnApplyTemplate()
224224
{
225225
_textBoxField.TextChanged += OnTextBoxTextChanged;
226226
_textBoxField.LostFocus += OnTextBoxLostFocus;
227-
_textBoxField.Text = Value?.ToString();
227+
_textBoxField.Text = Convert.ToString(Value, CultureInfo.CurrentCulture);
228228
}
229229

230230
}
@@ -233,15 +233,15 @@ private void OnTextBoxLostFocus(object sender, EventArgs e)
233233
{
234234
if (_textBoxField is { } textBoxField)
235235
{
236-
textBoxField.Text = Value?.ToString();
236+
textBoxField.Text = Convert.ToString(Value, CultureInfo.CurrentCulture);
237237
}
238238
}
239239

240240
private void OnTextBoxTextChanged(object sender, EventArgs e)
241241
{
242242
if (_textBoxField is { } textBoxField)
243243
{
244-
if (TryParse(textBoxField.Text, CultureInfo.CurrentUICulture, out T? value))
244+
if (TryParse(textBoxField.Text, CultureInfo.CurrentCulture, out T? value))
245245
{
246246
SetCurrentValue(ValueProperty, ClampValue(value));
247247
}

0 commit comments

Comments
 (0)