PassWordBox.Focus() does not scroll the passwordbox into view

2 posts, 1 answers
  1. Curtis
    Curtis avatar
    7 posts
    Member since:
    Jun 2011

    Posted 04 Dec 2014 Link to this post

    I have a stackpanel with 2 radtextbox and 2 radpasswordbox.

    On keydown event I move the focus from the first textbox to the second with radtextbox.focus.
    Then the second textbox is scrolled into view and the keyboard is openend

    But when i set the focus to the radpasswordbox the passwordbox is focused(colored rectangle around it) and the keyboard openend but the box is not scrollend into view.

    The default passwordbox of the Windows Phone SDK does scroll into view.

    I think it has something to do that the radtextbox is a descendent from the normal textbox and both have the scrolling behavior and radpasswordbox is descendent of radcontrol.

    Is this a little bug?

    Code example that does work with textbox, passwordbox and radtextbox but not with radpasswordbox:

    private void OnKeyDown(object sender, System.Windows.Input.KeyEventArgs e)
            {
                if (e.Key != Key.Enter) return;
                var control = sender as Control;
                if (control != null) control.TabToNextControl((Panel)control.Parent, this);
            }

    public static void TabToNextControl(this Control control, Panel parentContainer, Page parentPage)
            {
                // First hide the virtual keyboard
                parentPage.Focus(); 

                // Add 1 to calculate the next tab index
                int nextTabIndex = control.TabIndex + 1;

                // Check the controls in the parentcontainer for the next tab index and focus that control
                foreach (var c in parentContainer.ChildrenOfType<Control>())
                {
                    if (c.TabIndex.Equals(nextTabIndex))
                    {
                        c.Focus();
                        break;
                    }
                }
               
            }
  2. Answer
    Ivaylo Gergov
    Admin
    Ivaylo Gergov avatar
    661 posts

    Posted 09 Dec 2014 Link to this post

    Hello,

    Indeed, I was able to reproduce this behavior. I will log this and we will try to fix it in some of our next releases.

    Thank you for your time and valuable feedback. I have updated your Telerik points.

    Regards,
    Ivaylo Gergov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. DevCraft banner
Back to Top