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

Focus issue - is something stealing my focus?

1 Answer 192 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Anders
Top achievements
Rank 1
Anders asked on 29 Mar 2011, 08:01 AM
Hi Telerik,

It's perfectly possible that my issue is due to not understanding the focus topic, but the general WPF examples I find do not seem to work for me with RadDocking.

Goal / What I try to achieve:
- I wish to be able to double-click a row in a RadGridView, which is inside a RadPane.
- When double-clicking, I wish to open another RadPane, potentially one that's already open and focus a specific control (RadMaskedTextBox) inside the new RadPane.

(Our inspiration is the Error List in Visual Studio - our goal is exactly the same, directing the user to be able to edit a specific, problematic value).

Problem:
The control is not focused, rather the initial window is focused.

What I do:
I use Keyboard.Focus() to focus the RadPane
I use Keyboard.Focus() to focus the specific control.
It's done after the control is loaded and the specific control has .Focusable==.IsVisible==true
Result: System.Windows.Input.Keyboard.FocusedElement shows the desired control.
So far so good!
In the eventhandler OnRowActivated I set e.Handled = true

But when I exit the eventhandler OnRowActivated (that is: after debugging, the app is running again), the Error window has focus, not the one I just gave focus to.

So do my Telerik controls 'draw back' the focus as part of wrapping up the OnRowActivated event handler, or do you have some ideas on what to try out?

Thanks,

Anders, Denmark

1 Answer, 1 is accepted

Sort by
0
Milan
Telerik team
answered on 29 Mar 2011, 08:23 AM

Hi Anders,

Debugging and Focus do not work together quite nicely since Visual Studio would steal the focus when you debug. 

Here are a few pointers that might help you: You could try to focus the pane by using the Focus method (myPane.Focus()). If that does not help you could also try to run the Focus command through the Dispatcher.



Kind regards,
Milan
the Telerik team
Tags
GridView
Asked by
Anders
Top achievements
Rank 1
Answers by
Milan
Telerik team
Share this question
or