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

Focus issue - is something stealing my focus?

9 Answers 571 Views
Docking
This is a migrated thread and some comments may be shown as answers.
Anders
Top achievements
Rank 1
Anders asked on 25 Mar 2011, 11:05 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

9 Answers, 1 is accepted

Sort by
0
Arnstein
Top achievements
Rank 1
answered on 30 Mar 2011, 08:21 AM
I'm having similar focus problem trying to initially set focus on a textbox when a RadPane is loaded. The TextBox should have got focus automatically but even when setting focus on parent elements and finally the textbox, focus is set elsewhere.

Arnstein
0
George
Telerik team
answered on 31 Mar 2011, 12:18 PM
Hello,


I tried to reproduce the issue, but to no avail. Attached you can find a sample project. On a button click, a new pane is generated and added to the RadPaneGroup. The both scenarios are implemented:
  • Textbox inside a RadPane
  • RadMaskedTextBox inside a RadPane

Both controls are focused when the RadPanes are added to the RadPaneGroup. 

Used assemblies: Latest official Q1 2011 release.

Please, let me know if I do something wrong. I am glad to assist you further.


  Best wishes,
George
the Telerik team
0
Arnstein
Top achievements
Rank 1
answered on 31 Mar 2011, 02:42 PM
I'm not able to reproduce this in a sample. Your project works just fine. I'm loading panes from a saved layout, and I'm trying to set focus on a RadMaskedTextBox on the radpane which is loaded first. The textbox has a watermark so I can see that the textbox actually gets focus at one point, but then looses it again (Also tried focusing other controls).
Snoop (http://snoopwpf.codeplex.com/) tells me that Keyboard.FocusedElement is on a FakePopupWindow, do you know if it's possible to set Focusable to false on this control? I don't know if this is the real issue, and I don't know why the FakePopupWindow would get focus in the first place. Any suggestions would be welcome.

Best regards,
Arnstein
0
George
Telerik team
answered on 31 Mar 2011, 02:57 PM
Hi Arnstein,

 
Do you have any floating windows in your application? Is the RadMaskedTextBox placed in a floating window or not?

Kind regards,
George
the Telerik team
0
Arnstein
Top achievements
Rank 1
answered on 31 Mar 2011, 03:02 PM
The textbox is not in a floating window, and there are no floating windows present.

Arnstein
0
George
Telerik team
answered on 06 Apr 2011, 09:51 AM
Hello Arnstein,

 
I tried to reproduce the problem, but to no avail. Attached you can find the sample. Please, add the latest Q1 binaries and give it a try.

Regards,
George
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Arnstein
Top achievements
Rank 1
answered on 06 Apr 2011, 02:24 PM
Thanks for your efforts George. In your sample I've recreated one issue related to the fakepopwindow. I've added a Tabcontrol with two tabitems. Each of these tabitems has a RadDocking, and I've duplicated your RadDocking in these two tabitems. When I switch between the tabitems keyboard focus is set on a FakePopupWindow.

To recreate, simply add to your sample :

<TabControl Grid.Row="2">
    <TabItem Header="Tab1" >
        <!--<telerik:RadDocking Name="Docking1">...-->
    </TabItem>
    <TabItem Header="Tab2">
        <!--<telerik:RadDocking Name="Docking2">...-->
    </TabItem>
</TabControl>

Hopefully you can figure out what's going on :)
0
Arnstein
Top achievements
Rank 1
answered on 12 Apr 2011, 07:48 AM
There is already a bug report for my case:
http://www.telerik.com/support/pits.aspx#/public/wpf/2134
0
George
Telerik team
answered on 12 Apr 2011, 08:25 AM
Hello Arnstein,

 
Please, excuse me for this misunderstanding. Yes, we are aware of this problem when a RadDocking is placed in a RadTab control. You could vote for it and track its progress in the PITS system. We will definitely look into this issue in our further releases.

Greetings,
George
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Docking
Asked by
Anders
Top achievements
Rank 1
Answers by
Arnstein
Top achievements
Rank 1
George
Telerik team
Share this question
or