You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 10, 2020. It is now read-only.
I was trying to use the KeyUp event in a PhoneTextBox to focus the PhonePasswordBox in a typical username-password form, but it just wasn't working. PhonePasswordBox.focus(), at least in this case, does not cause the keyboard to come up and the input box to actually be focused.
In my case, I fixed this with the following extension method:
public static void FocusReal(this PhonePasswordBox pb)
{
var grid = System.Windows.Media.VisualTreeHelper.GetChild(pb, 0);
PasswordBox realpb = System.Windows.Media.VisualTreeHelper.GetChild(grid, 2) as PasswordBox;
realpb.Focus();
}
I was using a modified template (which did not modify the name or type of the actual PasswordBox object), so that is probably the cause of the problem. Also, my solution will not work if the template is changed so that the actual PasswordBox is not in the same position.
Ideally, the focus() code should look for either an object named "PasswordBox" inside the tree, whatever its position, or the first PasswordBox object inside the tree, whatever its name.
The text was updated successfully, but these errors were encountered:
Thanks for the detailed bug report. I just committed a fix. BTW the modified template is not the cause and any template should be fine as long as the "PasswordBox" part is present.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I was trying to use the KeyUp event in a PhoneTextBox to focus the PhonePasswordBox in a typical username-password form, but it just wasn't working. PhonePasswordBox.focus(), at least in this case, does not cause the keyboard to come up and the input box to actually be focused.
In my case, I fixed this with the following extension method:
I was using a modified template (which did not modify the name or type of the actual PasswordBox object), so that is probably the cause of the problem. Also, my solution will not work if the template is changed so that the actual PasswordBox is not in the same position.
Ideally, the focus() code should look for either an object named "PasswordBox" inside the tree, whatever its position, or the first PasswordBox object inside the tree, whatever its name.
The text was updated successfully, but these errors were encountered: