private static void OnStringFormatChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { NumericUpDown nud = (NumericUpDown)d; nud.SetRemoveStringFormatFromText((string)e.NewValue); if (nud._valueTextBox != null && nud.Value.HasValue) { nud.InternalSetText(nud.Value); } }
private static void OnStringFormatChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { NumericUpDown numericUpDown = (NumericUpDown)d; numericUpDown.SetRemoveStringFormatFromText((string)e.NewValue); if (numericUpDown._valueTextBox != null && numericUpDown.Value.HasValue) { numericUpDown.InternalSetText(numericUpDown.Value); } numericUpDown.HasDecimals = !NumericUpDown.RegexStringFormatHexadecimal.IsMatch((string)e.NewValue); }
private static void OnStringFormatChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { NumericUpDown nud = (NumericUpDown)d; nud.SetRemoveStringFormatFromText((string)e.NewValue); if (nud._valueTextBox != null && nud.Value.HasValue) { nud.InternalSetText(nud.Value); } if (!nud.HasDecimals && RegexStringFormatHexadecimal.IsMatch((string)e.NewValue)) { nud.SetCurrentValue(HasDecimalsProperty, true); } }
private static void OnStringFormatChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { NumericUpDown nud = (NumericUpDown)d; if (nud._valueTextBox != null && nud.Value.HasValue) { nud.InternalSetText(nud.Value); } var value = (string)e.NewValue; if (!nud.NumericInputMode.HasFlag(NumericInput.Decimal) && !string.IsNullOrEmpty(value) && RegexStringFormatHexadecimal.IsMatch(value)) { nud.SetCurrentValue(NumericInputModeProperty, nud.NumericInputMode | NumericInput.Decimal); } }