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

Programmatic Focus behaves different than tab or selecting

1 Answer 31 Views
MaskedInput (Numeric, DateTime, Text, Currency)
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 2
danparker276 asked on 06 Mar 2014, 07:14 PM
Then I click on a MaskedTextInput, it's all selected and in insert mode, so if I have '8888' in the value and press 1, everything is replaced by 1.

When I set the focus on the code behind, I press '1' and get '1888' then when I press 1 again I get '11888' .  It's very strange behavior.

I have some sample code below.  When you press the button I programmatically set the focus on the RadMaskedTextInput.  Compare this to when you selected it with a mouse, or tab to it:

<Window x:Class="FocusOnTextBox6.MainWindow"
        Title="MainWindow" Height="350" Width="525">
            <Style x:Key="UpperCodes6Mask" TargetType="telerik:RadMaskedTextInput">
                <Setter Property="FontFamily" Value="Segoe UI" />
                <Setter Property="Margin" Value="0 0 0 0" />
                <Setter Property="Width" Value="60" />
                <Setter Property="Height" Value="20" />
                <Setter Property="Padding" Value="0" />
                <Setter Property="Placeholder" Value=" " />
                <Setter Property="IsClearButtonVisible" Value="False" />
                <Setter Property="TextMode" Value="PlainText" />
                <Setter Property="SectionsNavigationMode" Value="None" />
                <Setter Property="IsLastPositionEditable" Value="False" />
                <Setter Property="InputBehavior" Value="Insert" />
                <Setter Property="SelectionOnFocus" Value="SelectAll" />
                <Setter Property="Mask" Value=">a6" />
        <StackPanel Orientation="Horizontal">
            <telerik:RadMaskedTextInput Margin="3 0 0 0" Height="20" Padding="0"  Style="{StaticResource UpperCodes6Mask}"
                    Name="tbClid" />
            <TextBox Name="tbTest" Margin="10 0 0 0" Height="25"  Width="50"/>
            <Button Name="btnTest" Margin="20 0 0 0" Content="Test Focus" Height="25" Width="100" Click="btnTest_Click" />
            <Button Name="btnTestRegular" Margin="20 0 0 0" Content="Test Focus TextBox" Height="25" Width="100" Click="btnTestRegular_Click" />

namespace FocusOnTextBox6
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
        public MainWindow()
        private void btnTest_Click(object sender, RoutedEventArgs e)
            tbClid.Value = "8888";
        private void btnTestRegular_Click(object sender, RoutedEventArgs e)
            tbTest.Text = "9999";

1 Answer, 1 is accepted

Sort by
Telerik team
answered on 11 Mar 2014, 01:00 PM

Thank you for pointing this out. I have logged this as a bug report and our developers will investigate it in details. As a gratitude to your finding your Telerik points are now updated.

You can keep track on the progress of this bug report and to vote for it using the link below:


DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.

MaskedInput (Numeric, DateTime, Text, Currency)
Asked by
Top achievements
Rank 2
Answers by
Telerik team
Share this question