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

How to goto last inserted chars or select all inserted chars

7 Answers 48 Views
MaskedInput (Numeric, DateTime, Text, Currency)
This is a migrated thread and some comments may be shown as answers.
Dario Concilio
Top achievements
Rank 2
Dario Concilio asked on 08 Nov 2016, 11:01 AM

Hi to all,

I'm seeing a demo, I would to goto at last char, but not last char of mask.

I try to explane more clearly, I have example that I attached, when I get focus of control, Carrer appears at first position, I have a value of some characters and thay are less than max length of mask (a20), if a try to press "End", it goto to last char of mask, I would to goto at last inserted char.

Other question, how can I select all, but only inserted value?

 

SelectionOnFocus gives me several mode when I get focous, it would be nice to have "SelectAllValue" or "CarretToEndValue"

Can I do it or custom it?

7 Answers, 1 is accepted

Sort by
0
Milena
Telerik team
answered on 11 Nov 2016, 07:57 AM
Hello Dario,

From your explanation and pictures I suppose that you are using RadMaskedTextInputt with Mask="a20". In this case the behavior you are observing is expected, because the placeholders (not only the mask value) are considered as chars. I could suggest you another approach to get the described behavior. You can use nomask (Mask="") and setting MaxTextLenght to 20 in order to achieve the same restriction for user input: 
<telerik:RadMaskedTextInput Value="text" maskedInput:MaskedInputExtensions.MaxTextLength="20"
Mask="" SelectionOnFocus="CaretToEnd"/>
 
<telerik:RadMaskedTextInput Value="text" maskedInput:MaskedInputExtensions.MaxTextLength="20" Mask="" SelectionOnFocus="SelectAll"/>

This way when the focus is on the maskedinput the caret will be to the end of the vale (when  SelectionOnFocus is set to "CaretToEnd") or will select all the value (when SelectionOnFocus is set to "SelectAll").

Please let us know if this works for you. 


Regards,
Milena
Telerik by Progress
Do you need help with upgrading your WPF project? Try the Telerik API Analyzer and share your thoughts!
0
Dario Concilio
Top achievements
Rank 2
answered on 16 Nov 2016, 01:47 PM
I see, but how can I include "maskedInput:MaskedInputExtensions.MaxTextLength" into a Style?
0
Milena
Telerik team
answered on 18 Nov 2016, 08:17 AM
Hello Dario,

you can set MaxTextLength property like this:
<Window ...
        xmlns:maskedInput="clr-namespace:Telerik.Windows.Controls.MaskedInput;assembly=Telerik.Windows.Controls.Input">
<Window.Resources>
  <Style TargetType="telerik:RadMaskedTextInput">
    <Setter Property="maskedInput:MaskedInputExtensions.MaxTextLength" Value="20"/>
  </Style>
</Window.Resources>

 I hope this information helps.

Regards,
Milena
Telerik by Progress
Telerik UI for WPF is ready for Visual Studio 2017 RC! Learn more.
0
Dario Concilio
Top achievements
Rank 2
answered on 18 Nov 2016, 12:42 PM

Ok perfect.

If user insert an underscore character and he comes out from MaskedTextInput, this character disappears, what can I do to resolve this issue?

0
Dario Concilio
Top achievements
Rank 2
answered on 18 Nov 2016, 12:44 PM

Ehm... sorry

I'm using these setters

<Style x:Key="FieldRadMaskedTextInputStyle" TargetType="telerik:RadMaskedTextInput" BasedOn="{StaticResource RadMaskedTextInputStyle}">
        <Setter Property="Margin" Value="5"/>
        <Setter Property="HorizontalAlignment" Value="Left"/>
        <Setter Property="TextMode" Value="PlainText"/>
        <Setter Property="SpinMode" Value="None"/>
        <Setter Property="SelectionOnFocus" Value="CaretToBeginning"/>
        <Setter Property="UpdateValueEvent" Value="PropertyChanged"/>
        <Setter Property="InputBehavior" Value="Replace"/>
        <Setter Property="EmptyContent" Value=""/>
        <Setter Property="Mask" Value=""/>
        <Setter Property="SectionsNavigationMode" Value="None"/>
        <Setter Property="IsClearButtonVisible" Value="False"/>
0
Accepted
Milena
Telerik team
answered on 22 Nov 2016, 01:05 PM
Hello Dario, 

Thank you for reporting this issue. I logged it in our Feedback portal where you can track its progress. I have also updated your Telerik points as a small appreciation for your cooperation.

In the meantime, as a workaround you can set Placeholder property to empty string ( <Setter Property="Placeholder" Value=""/>). The issue is caused by the fact that the default value of Placeholder  property is underscore. It would be expected behavior if the mask is different then NoMask(Mask=""), but in this case we can confirm that it is a bug.

Please excuse us for any inconvenience caused.

Regards,
Milena
Telerik by Progress
Telerik UI for WPF is ready for Visual Studio 2017 RC! Learn more.
0
Dario Concilio
Top achievements
Rank 2
answered on 23 Nov 2016, 01:12 PM
It works! Thank you.
Tags
MaskedInput (Numeric, DateTime, Text, Currency)
Asked by
Dario Concilio
Top achievements
Rank 2
Answers by
Milena
Telerik team
Dario Concilio
Top achievements
Rank 2
Share this question
or