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

RadMaskedNumericInput - CaretToEnd won't place the caret at the when Mask=""

4 Answers 98 Views
MaskedInput (Numeric, DateTime, Text, Currency)
This is a migrated thread and some comments may be shown as answers.
Joel
Top achievements
Rank 1
Iron
Joel asked on 29 Nov 2013, 06:20 AM
<Style TargetType="telerik:RadMaskedNumericInput">
          <Setter Property="FontWeight" Value="Normal" />
          <Setter Property="Width" Value="100" />
          <Setter Property="TextMode" Value="PlainText" />
          <Setter Property="IsClearButtonVisible" Value="True"/>
          <Setter Property="AllowSkipPlaceholders" Value="False"/>
          <Setter Property="AutoFillNumberGroupSeparators" Value="False"/>
          <Setter Property="SelectionOnFocus" Value="CaretToEnd"/>
          <Setter Property="HorizontalContentAlignment" Value="Left"/>
          <Setter Property="input:MaskedInputExtensions.Maximum" Value="99999"/>
          <Setter Property="Mask" Value=""/>
</Style>

The caret is always placed after the fist number when the control is on focus.
I am using 2013 Q3 version

4 Answers, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 29 Nov 2013, 09:13 AM
Hi Joel,

You are right about this issue - the SelectionOnFocus does not work well if the Mask is "". However, if you need the caret to be placed at the end of the text in this scenario, you can try the following:
  • Remove the SelectionOnFocus setter.
  • Add this setting:
<Setter Property="maskedInput:MaskedInputExtensions.CaretToEndOfTextOnFocus" Value="True"/>
where maskedInput is defined like so:
xmlns:maskedInput="clr-namespace:Telerik.Windows.Controls.MaskedInput;assembly=Telerik.Windows.Controls.Input"

Please let us know if this helps you proceed further.

Regards,
Petar Mladenov
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
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
Joel
Top achievements
Rank 1
Iron
answered on 29 Nov 2013, 09:40 AM
No, it does not work.
I have ported your project to VS2010.
0
Petar Mladenov
Telerik team
answered on 03 Dec 2013, 01:23 PM
Hello Joel,

We tested this more precisely and it appears that the logic of this properly is implemented only for MaskedTextInput. We logged a related item in our FeedBackPortal. As a workaround you can use MaskedTextInput instead of Numeric (and bind its value to double proeprty with Converter) or use the GotFocus event handler in order to place the SelectionStart (caret position properly).

Regards,
Petar Mladenov
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
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
Joel
Top achievements
Rank 1
Iron
answered on 04 Dec 2013, 12:49 AM
As a workaround, i have implemented something similar to this post:
http://stackoverflow.com/questions/1647815/how-to-add-a-blend-behavior-in-a-style-setter

<UserControl.Resources>
       <helper:Triggers x:Key="putCaretToEnd" x:Shared="False">
           <i:EventTrigger EventName="GotFocus">
               <helper:PutCaretToEndAction/>
           </i:EventTrigger>
       </helper:Triggers>
 
       <Style x:Key="maskedNumInputStyle" TargetType="telerik:RadMaskedNumericInput">
           <Setter Property="FontWeight" Value="Normal" />
           <Setter Property="Width" Value="100" />
           <Setter Property="TextMode" Value="PlainText" />
           <Setter Property="IsClearButtonVisible" Value="True"/>
           <Setter Property="AllowSkipPlaceholders" Value="False"/>
           <Setter Property="AutoFillNumberGroupSeparators" Value="False"/>
           <Setter Property="HorizontalContentAlignment" Value="Left"/>
           <Setter Property="Mask" Value=""/>
           <!-- The CaretToEnd value is not working for SelectionOnFocus-->
           <!--<Setter Property="SelectionOnFocus" Value="CaretToEnd"/>-->
           <Setter Property="helper:SupplementaryInteraction.Triggers" Value="{StaticResource putCaretToEnd}"/>
       </Style>
   </UserControl.Resources>
Tags
MaskedInput (Numeric, DateTime, Text, Currency)
Asked by
Joel
Top achievements
Rank 1
Iron
Answers by
Petar Mladenov
Telerik team
Joel
Top achievements
Rank 1
Iron
Share this question
or