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

Setting Focus

7 Answers 1349 Views
MaskedInput (Numeric, DateTime, Text, Currency)
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 1
Richard asked on 19 Nov 2013, 06:32 PM
I'm trying to set a RadMaskedTextInput as the initially focused element by using FocusManager.FocusedElement. However this is proving problematic as it is focusing the element but not putting focus into the editable area (If I press tab I get the result that I want). This issue can be reproduced with the following code:

<StackPanel FocusManager.FocusedElement="{Binding ElementName=RadMaskedTextInput}">
            <TextBox x:Name="NonTelerikTextBox"></TextBox>
            <telerik:RadMaskedTextInput x:Name="RadMaskedTextInput"/>
        </StackPanel>

It works fine for the TextBox, but not for the RadMaskedTextInput. I'd resort to sending a tab key press, but SendKeys isn't available in WPF and I don't want to PInvoking.

Any suggestions to get this working?

7 Answers, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 22 Nov 2013, 11:28 AM
Hello Richard,

You have hit a known issue in our MaskedInput control. It will be fixed in the next week's internal build well as in the Service Pack coming in a few weeks. Please excuse us for the inconvenience caused.

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
Alex
Top achievements
Rank 1
answered on 03 Jun 2015, 11:33 AM

Hello!

However the Bug is still present(

Is there the possibility to solve this problem? 

0
Petar Mladenov
Telerik team
answered on 08 Jun 2015, 07:02 AM
Hi Alex,

This bug is marked as resolved and the foolowing scenarios work on our side:
- setting FocusedElement in XAML:
FocusManager.FocusedElement="{Binding ElementName=tBox}"
- invoking Focus() on MaskedInput control in code behind.

Could you please let us know your exact scenario, what is the unexpected behavior and which version of our product you use ? Thank you in advance for your cooperation.

Regards,
Petar Mladenov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Alex
Top achievements
Rank 1
answered on 09 Jun 2015, 06:25 AM

 

Version of product is 2015.1.225.40

The scenario is following:

<DataTemplate x:Key="PhoneDataTemplate" DataType="classes:CardFieldPhone">
        <telerik:RadMaskedTextInput Width="100" x:Name="PhoneMaskedNumber" InputBehavior="Replace"
                                    UpdateValueEvent="LostFocus"
                                    IsClearButtonVisible="False" HorizontalAlignment="Stretch" Margin="0,0,4,0"
                                    Value="{Binding PhoneMaskedNumber, UpdateSourceTrigger=PropertyChanged}"
                                    Mask="{Binding PhoneMask}">
            <telerik:RadMaskedTextInput.InputBindings>
                <KeyBinding Key="Enter" Command="{x:Static msc:ApplicationCommandLibrary.ConfirmValueChange}"
                            CommandParameter="{Binding}" />
            </telerik:RadMaskedTextInput.InputBindings>
        </telerik:RadMaskedTextInput>
    <DataTemplate.Triggers>
        <DataTrigger Binding="{Binding Path=IsSelected}" Value="True">
            <Setter TargetName="PhoneMaskedNumber" Property="FocusManager.FocusedElement"
                    Value="{Binding ElementName=PhoneMaskedNumber}" />
        </DataTrigger>
    </DataTemplate.Triggers>
</DataTemplate>

Thank You! 

 

Regards,

Alex

 

0
Petar Mladenov
Telerik team
answered on 11 Jun 2015, 06:47 AM
Hi Alex,

Where is this template used - is it in GridView , or other control Templates ? Can you please replace the MaskedInput with TextBox and check whether the focus is successfully placed inside the TextBox ?
Thank you in advance for your cooperation.

Regards,
Petar Mladenov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
malcolm
Top achievements
Rank 1
answered on 15 Dec 2016, 10:07 AM

This problem still seems to exist.  Version 2016.3.1024.

<telerik:RadMaskedNumericInput x:Name="TextBoxLottoStraightBet"
                                                        Grid.Column="2"
                                                        HorizontalAlignment="Stretch"
                                                        VerticalAlignment="Center"
                                                        Mask="c5.2"
                                                        TextMode="PlainText"
                                                        SelectionOnFocus="SelectAll"
                                                        AcceptsReturn="False"
                                                        Margin="5,0,5,0"
                                                        AutoFillZeros="False"  
                                                        Focusable="True"
                                                        IsTabStop="False"
                                                        KeyboardNavigation.IsTabStop="True"
                                                        KeyboardNavigation.TabIndex="1"
                                                        maskedInput:MaskedInputExtensions.IsEditorTabStop="True"
                                                        maskedInput:MaskedInputExtensions.Minimum="0"
                                                        maskedInput:MaskedInputExtensions.Maximum="9999.99"
                                                        IsClearButtonVisible="False"
                                                        AutoFillNumberGroupSeparators = "False"
                                                        GotFocus="TextBoxLottoStraightBet_GotFocus"
                                                        KeyDown="TextBoxLottoStraightBet_KeyDown"
                                    />

 

Setting focus in code

TextBoxLottoStraightBet.Focus();

 

This sets the focus to the control but not the editor, it requires the user to press Enter in order to change the content. If this is by design, how can I cause the Focus() method to send the user directly to the editable control?

0
Petar Mladenov
Telerik team
answered on 19 Dec 2016, 09:58 AM
Hello Malcolm,

KeyboardNavigation.IsTabStop should be synced with IsTabStop and they both need to be False. This way the focus will move tot he Editor TextBox successfully:

KeyboardNavigation.IsTabStop="False"


Regards,
Petar Mladenov
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
MaskedInput (Numeric, DateTime, Text, Currency)
Asked by
Richard
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Alex
Top achievements
Rank 1
malcolm
Top achievements
Rank 1
Share this question
or