RadMaskedTextInput - LostFocus - GotFocus

5 posts, 0 answers
  1. ITA
    ITA avatar
    383 posts
    Member since:
    Aug 2009

    Posted 04 Jun 2012 Link to this post

    Hi,

    how can i add a errorhandling to a RadMaskedTextInput? On LostFocus-Event i check if the Input is ok or not. If the
    Input is not ok, i want to clear the RadMaskedTextInput and set the Cursor back in the box.

    To clear is no problem:

    RadMaskedTextInput.Text = "";

    But how to set the Focus?

    RadMaskedTextInput.Focus(); does not work.

    Thanks Best Regards
    Rene
  2. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 07 Jun 2012 Link to this post

    Hello Rene,

     Could you please send us your XAML configuration? This way we would be better able to advice you on how to set the focus successfully. On the other hand, this is not typical validation scenario. Usually a red border occurs and does not disappear until a valid input is written and there is no automatic deletion of input. I guess you know our validation samples and help article. Hope they can be useful to you.

    Kind regards,
    Petar Mladenov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. UI for WPF is Visual Studio 2017 Ready
  4. Diego
    Diego avatar
    13 posts
    Member since:
    Aug 2012

    Posted 14 Aug 2013 Link to this post

    Hi,

    I got a question related to this thread.

    I Got a RadMaskedTextInput inside a RadTreeviewItem (i don't know if its relevant but i populate this tree with HirerachicalTemplate MVVM), if i select another item in the radtreeview i got to validate that the RadMaskedTextInput is not empty, if its empty the RadTreeviewItem must be selected again and the RadMaskedTextInput bus be Focused again. I'm trying to set focus to the RadMaskedTextInput through code behind, but it doesnt seems to work. Do you have any advise for me?


    thanks in advance.
  5. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 19 Aug 2013 Link to this post

    Hello Diego,

     To better indicate the real issue, could you please elaborate more on your scenario ?

    • Do you use the MaskedTextInput in ItemEditTemplate or simply ItemTemplate ? Could you please send us the XAML of the template used?
    • Is your TreeView editable ?
    • On which event do you perform the focusing code ? Does this code work on a simple Button CLick ?
    Actually you can take advantage of our 24h priority support by sending a support ticket. You will be able to attach a reproducible isolated project that we can investigate better.
    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 >>
  6. Diego
    Diego avatar
    13 posts
    Member since:
    Aug 2012

    Posted 22 Aug 2013 Link to this post

    Hi the problem was with the virtualization of the treeview, i added a dispatcher, and that was pretty much it. 
    thank you very much!
Back to Top
UI for WPF is Visual Studio 2017 Ready