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

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

1 Answer 202 Views
PasswordBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Curtis
Top achievements
Rank 1
Curtis asked on 04 Dec 2014, 04:03 PM
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;
                }
            }
           
        }

1 Answer, 1 is accepted

Sort by
0
Ivaylo Gergov
Telerik team
answered on 09 Dec 2014, 12:06 PM
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.

 
Tags
PasswordBox
Asked by
Curtis
Top achievements
Rank 1
Answers by
Ivaylo Gergov
Telerik team
Share this question
or