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:
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"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
Title
=
"MainWindow"
Height
=
"350"
Width
=
"525"
>
<
Grid
>
<
Grid.Resources
>
<
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" />
</
Style
>
</
Grid.Resources
>
<
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"
/>
</
StackPanel
>
</
Grid
>
</
Window
>
namespace
FocusOnTextBox6
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public
partial
class
MainWindow : Window
{
public
MainWindow()
{
InitializeComponent();
}
private
void
btnTest_Click(
object
sender, RoutedEventArgs e)
{
tbClid.Value =
"8888"
;
tbClid.Focus();
}
private
void
btnTestRegular_Click(
object
sender, RoutedEventArgs e)
{
tbTest.Text =
"9999"
;
tbTest.Focus();
tbTest.SelectAll();
}
}
}