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

How to make RadMaskedTextInput behave like normal textbox

7 Answers 475 Views
MaskedInput (Numeric, DateTime, Text, Currency)
This is a migrated thread and some comments may be shown as answers.
Henri
Top achievements
Rank 1
Henri asked on 02 Sep 2013, 09:09 AM
Hi,

I'm trying to make the RadMaskedTextInput behave like the plain textboxes, but taking advantage of built in clear button.
I can not make it behave like a normal text box, especially related to tab order, caret position etc.
(using. v2013.2.729.1050, with theme Expression_Dark)

Here is my code:
<Grid x:Name="LayoutRoot">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="120"/>
            <ColumnDefinition Width="20"/>
            <ColumnDefinition Width="120"/>
        </Grid.ColumnDefinitions>
 
        <telerik:RadMaskedTextInput Grid.Row="0" Grid.Column="0"
                                    HorizontalAlignment="Stretch"
                                    Mask="" InputBehavior="Insert" SelectionOnFocus="CaretToEnd" TextMode="PlainText"
                                    SectionsNavigationMode="None"  />
        <telerik:RadMaskedTextInput Grid.Row="0" Grid.Column="2"
                                    HorizontalAlignment="Stretch"
                                    Mask="" InputBehavior="Insert" SelectionOnFocus="CaretToEnd" TextMode="PlainText"
                                    SectionsNavigationMode="None" />
 
        <TextBox Grid.Row="1" Grid.Column="0"></TextBox>
        <TextBox Grid.Row="1" Grid.Column="2"></TextBox>
    </Grid>



Thank you for your assistance.
Henri

7 Answers, 1 is accepted

Sort by
0
Pavel R. Pavlov
Telerik team
answered on 05 Sep 2013, 07:49 AM
Hello Henri,

We designed the RadMaskedTextInput control to behave like the native TextBox when the Mask property is set to "" (empty string). Can you please elaborate more on your scenario so we can decide if there is an easy approach to achieve all of your requirements.

It will be great if you can send us your current implementation and specify the behavior that you need to be changed to match the native control.

Thank you for your kind cooperation.

Regards,
Pavel R. Pavlov
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Henri
Top achievements
Rank 1
answered on 06 Sep 2013, 02:52 PM
Hi Pavel,
If you try the snippet in my post, you can see clearly the difference in behavior between the two textboxes and the two radmaskedtextinputs. Just look at how the caret is positioned, what is selected, how the next control gets the focus.
Best regards,
Henri
0
Petar Mladenov
Telerik team
answered on 11 Sep 2013, 07:20 AM
Hi Henri,

 Let me try to suggest some possible ways to solve these issues:
1) Position of the caret. In normal textbox the caret goes to the end of the text when the focus is received by tabbing with keyboard. In Q2 2013 SP we created an attached property to solve this in MaskedTextInput:

<telerik:RadMaskedTextInput Grid.Row="0" Grid.Column="2" maskedInput:MaskedInputExtensions.CaretToEndOfTextOnFocus="True"
where:
xmlns:maskedInput="clr-namespace:Telerik.Windows.Controls.MaskedInput;assembly=Telerik.Windows.Controls.Input"
2) Focusing. We have this issue in our PITS and we will do our best to have it fixed for Q3. As a temporary workaround you can use the GotFocus event handler like so:
private void RadMaskedTextInput_GotFocus(object sender, RoutedEventArgs e)
       {
           var tBox = (sender as RadMaskedTextInput).ChildrenOfType<TextBox>().FirstOrDefault();
           if (tBox != null)
           {
               tBox.Focus();
           }
       }
3) Could you please elaborate more on the selection issues you have experienced?
4) Currently there are also issues with misplaced symbols when user types quickly. Again, we will try to resolve them for Q3 next month. Regards,
Petar Mladenov
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Henri
Top achievements
Rank 1
answered on 11 Sep 2013, 09:05 AM

Hi Petar,

Thank you for the attached sample, it improves a little but there are still problems.
 
Unfortunately, when the second RadMaskedTextInput field has the focus,
it is impossible to tab back (shift+tab) into the first RadMaskedTextInput.
This in contrast to the two textboxes on second row.

Also, when you freshly load the page , directly  click in the second RadMaskedTextInput, the browser is frozen.

Best regards,
Henri

0
Petar Mladenov
Telerik team
answered on 11 Sep 2013, 02:41 PM
Hello Henri,

 We are aware of this issue and we will try to fix it for Q3 as well.

Regards,
Petar Mladenov
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Henri
Top achievements
Rank 1
answered on 24 Sep 2013, 09:56 AM
I want to let you know that in hotfix 2013.2.0923 the issue is not resolved.
Clicking on the X (clear) in the radmaskedtextinput gives an error:

[Window Title]
Visual Studio Just-In-Time Debugger

[Main Instruction]
An unhandled exception ('Unhandled Error in Silverlight Application Object reference not set to an instance of an object.   at Telerik.Windows.Controls.RadMaskedTextInput.OnSelectionOnFocus(SelectionOnFocus selectionOnFocus)
   at Telerik.Windows.Controls.RadMaskedInputBase.HandleClear()
   at Telerik.Windows.Controls.RadMaskedInputBase.<.ctor>b__5(Object p)
   at Telerik.Windows.Controls.DelegateCommand.Execute(Object parameter)
   at Telerik.Windows.Controls.RadButton.ExecuteCommand()
   at Telerik.Windows.Controls.RadButton.OnClick()
   at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
   at System.Windows.Controls.Control.OnMouseLeftButtonUp(Control ctrl, EventArgs e)
   at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName, UInt32 flags)') occurred in iexplore.exe [6868].

The Just-In-Time debugger was launched without necessary security permissions. To debug this process, the Just-In-Time debugger must be run as an Administrator. Would you like to debug this process?

[V] View process details  [Yes, debug iexplore.exe] [No, cancel debugging]

[Expanded Information]
Process Name: C:\Program Files (x86)\Internet Explorer\iexplore.exe


Here is the xaml extract:

<telerik:RadMaskedTextInput Grid.Row="0" Grid.Column="0"
                               HorizontalAlignment="Stretch" maskedInput:MaskedInputExtensions.CaretToEndOfTextOnFocus="True"
                               Mask="" InputBehavior="Insert" SelectionOnFocus="CaretToEnd" TextMode="PlainText"
                               SectionsNavigationMode="None"  />



0
Petar Mladenov
Telerik team
answered on 27 Sep 2013, 11:34 AM
Hello Henri,

 Indeed, we have introduced this bug in the mentioned internal build. The fix for it will be included in the next week's internal build. We updated your telerik account points as a thanks for your cooperation.

Regards,
Petar Mladenov
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
MaskedInput (Numeric, DateTime, Text, Currency)
Asked by
Henri
Top achievements
Rank 1
Answers by
Pavel R. Pavlov
Telerik team
Henri
Top achievements
Rank 1
Petar Mladenov
Telerik team
Share this question
or