This question is locked. New answers and comments are not allowed.
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;
}
}
}
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;
}
}
}