This is a migrated thread and some comments may be shown as answers.

RadCalculatorPicker TextBox functionality

2 Answers 126 Views
Calculator
This is a migrated thread and some comments may be shown as answers.
Ken
Top achievements
Rank 1
Ken asked on 22 Apr 2018, 09:10 PM

I would like to use the RadCalculatorPicker in the following fashion:

In a dialog box or form, the user should be able to tab to the RadCalculatorPicker or click on its TextBox  and the border should highlight as other controls do and the entire text should be selected.

From this point, the user should be able to freely edit the text in the TextBox, as long as it remains numeric, and the text should remain as he edits it and be reflected in the calculator when it is pulled down.

The user should be able to tab or mouse away from the TextBox, perform operations on other controls and subsequently return to the TextBox, whereupon the text in the TextBox should remain as it was when he left it.  The Value should match this text.

While the user may/should be prevented from entering non-numeric characters, he should be able to leave the TextBox empty ("").  It's not necessary that the control return a double? for the Value, as I can wrap the control with my own code to do so, but being able to have an empty TextBox is desired.

In short, I want the control to function as a normal TextBox (with numeric characters only) until the user clicks on the dropdown button, at which point the calculator appears and, starting with the string in the TextBox, functions as it does today.

I can derive a UserControl from this to perform some of what I want to do, but the TextBox and calculator seem to be very tightly bound and it appears that programming it to function as I desire would be a PITA, if possible at all.

Is there a way to make the control function in this manner? If not, would you consider making changes to it or creating a new control in the future that would work this way?  The justification for it is to speed keyboard entry of numeric data while allowing the power of a calculator to be readily at hand.

Thanks

2 Answers, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 25 Apr 2018, 02:15 PM
Hey Ken,

I will check your requirement a bit later and will get back to you with more information on this within the next couple of days.

Regards,
Martin Ivanov
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
Martin Ivanov
Telerik team
answered on 27 Apr 2018, 11:41 AM
Hello Ken,

The RadCalculator picker doesn't support this out of the box. Currently, you can only type numbers and use the keyborad support of the calculator to execute the arithmetic operations. However, the control doesn't allow you to freely enter text. Implementing such functionality will require to enable typing into the default TextBox and also some complex validation applied to the entered string. Based on this you can set the Value property of the calculator. I could suggest you to try this approach and if it doesn't work for you to create a feature request in the UI for WPF feedback portal.

Here are could of tips for the custom implementation:
  • You can check the Editing Control Templates to see how to extract the template of RadCalculatorPicker. You can replace the TextBox showing the value with a custom editing control. For example RadMaskedTextInput. Or you can just set the TextBox IsReadOnly property to False.
  • After this you can bind the TextBox's Text to the Value property of the calculator. You can use an IValueConverter to parse the Text to a arithmetic operation, get the result and set it to the Value.

I hope that helps.

Regards,
Martin Ivanov
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Tags
Calculator
Asked by
Ken
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Share this question
or