When the ShowTextBox property is set to False and the dark palette of the Windows 11 theme is applied, the borders become invisible.
Additionally, the current tab navigation will focus on the right button (increase) first and then the left button (decrease) when the text box is hidden via the ShowTextBox. The tab navigation behavior should be that the left button is focused first then the right one, when the RadNumericUpDown control receives the keyboard focus.
public class CustomRadCalendar : RadCalendar
{
public override void OnApplyTemplate()
{
var transitionPanel = GetTemplateChild("TransitionPanel") as TransitionPanel;
if (transitionPanel != null)
{
TouchManager.AddTouchDownEventHandler(transitionPanel, this.OnTransitionPanelTouchDown);
}
base.OnApplyTemplate();
}
private void OnTransitionPanelTouchDown(object sender, TouchEventArgs args)
{
args.Handled = true;
}
}
Currently, the control doesn't allow to paste numeric strings with leading and trailing white spaces. For example " 35 ".
To achieve this, you can subscribe the RadNumericUpDown control to the Pasting event and implement the pasting manually.
DataObject.AddPastingHandler(this.numericUpDown, OnNumericUpDownPaste);
private void OnNumericUpDownPaste(object sender, DataObjectPastingEventArgs e)
{
var copiedString = e.DataObject.GetData(typeof(string)) as string;
if (copiedString != null)
{
copiedString = copiedString.Trim();
double number = 0;
var success = double.TryParse(copiedString, out number);
if (success)
{
this.numericUpDown.SetCurrentValue(RadNumericUpDown.ValueProperty, number);
e.CancelCommand();
}
}
}
As a workaround you can change the NumberNegativePattern to the default one like so: System.Globalization.CultureInfo ci = (System.Globalization.CultureInfo)System.Threading.Thread.CurrentThread.CurrentCulture.Clone(); ci.NumberFormat.NumberNegativePattern = 1; Thread.CurrentThread.CurrentCulture = ci; Thread.CurrentThread.CurrentUICulture = ci;
Available in LIB 2016.3.919 and also it would be available in 2016 R3 SP1.
In a scenario when the current culture uses "." as a decimal separator make it possible to have "," as a parsing decimal separator and at the same time have the current culture separator displayed in the control and vice versa.
Make it possible to be notified when the Value has been changed by user interaction by using the Up/Down buttons
Currently we're parsing Key.Decimal the same way we're parsing Key.OemPeriod. Our clients want to always type the culture decimal separator when pressing the Numpad separator key (del). Currently if the client uses a French culture, which decimal separator is comma - pressing the Numpad separator key does nothing. Workaround: Handling the RadNumericUpDown.PreviewKeyDown method: private void RadNumericUpDown_PreviewKeyDown(object sender, KeyEventArgs e) { var num = sender as RadNumericUpDown; if (e.Key == Key.Decimal || e.Key == Key.OemComma || e.Key == Key.OemPeriod) { var textBox = e.OriginalSource as System.Windows.Controls.TextBox; if (!textBox.Text.Contains(num.NumberDecimalSeparator)) { textBox.Text += num.NumberDecimalSeparator; textBox.CaretIndex = textBox.Text.Length; } e.Handled = true; } }
I am in need of a two digit display format using the NumericUpDown control. As I have to display the integer value "0" as "00" in all cases. This is a big draw back as I have to be complient to other systems. -Stefan
Hello, it would be great if we can have more control about the formatting of the value in the up/down. I have a scenario where I must use the control to edit a duration in minutes. When the duration is 1 hour or more, it should be displayed as 1:05, for example. This scenario would be feasible if you had a FormatValue and a ParseValue virtual methods, so we can inherit from the base class and customize completely the display. Patrick
Available in LIB version 2016.1.302, it will be also available in the 2016 Q2 Release.