Can't get cursor focus on a radwindow in SL5 OOB app. It's a popup from the mainpage.
Trying this in window_Loaded event.
UpdateLayout();
txtField.Focus();
3 Answers, 1 is accepted
0
Vladi
Telerik team
answered on 06 Jul 2012, 02:39 PM
Hello James,
To set the focus on a control you need to make sure that the control you want to be focused is loaded before setting the focus on it. Here is a sample method that puts the focus on the passed focusControl:
private void PutFocus(Control focusControl)
{
if (focusControl != null)
{
RoutedEventHandler loadedEventHandler = null;
loadedEventHandler = new RoutedEventHandler(delegate
{
focusControl.Loaded -= loadedEventHandler;
focusControl.Focus();
});
focusControl.Loaded += loadedEventHandler;
}
}
Hope this helps.
Kind regards,
Vladi
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
I have prepared and attached a sample project representing the described approach on how to set the focus on specific control. In the attached project the focus is set to textBox2.
Take a look at it and tell me if you are doing something different in your project.
Kind regards,
Vladi
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>