Hello,
We have a requirement that all the pane's share the same focus scope. This is so that we don't have ribbon contextual groups showing up from multiple logical scopes across different panes that all have focus.
Setting FocusManager.IsFocusScope="False" on the ContentPane resolves this issue for us, however, it introduces a new issue. When the window is floated, you can no longer tab through controls. I have verified this is still an issue in 14.2. Anyone how I might have floated pane's share the same focus scope? I thought maybe overriding GetUIParentCore to return the XamDockManager, but that did not resolve it.
Example xaml that demonstrates the issue:
Hello mikebm,
Thank you for your post!
I have been investigating this issue regarding focus on XamDockManager floating panes, and I have a couple of questions for you. In your description, you mention ribbon contextual groups showing up among multiple logical scopes, but in the sample code you have provided, I am not seeing a ribbon control included. Could you please provide some detail as to where you are using the ribbon control(s) in this case? Also, could you provide some more detail on the behavior you are seeing with the ribbon contextual groups between focused panes?
Regarding the textboxes not being able to be tabbed between when setting FocusManager.IsFocusScope to false, I have been able to reproduce this. I believe this is because when you set IsFocusScope to false for the content pane, it applies to each element in its content as well. This disallows the tab operation, and so you cannot tab through each textbox.
I also found this link to a page about focus operations that may help you: http://blogs.msdn.com/b/visualstudio/archive/2010/03/09/wpf-in-visual-studio-2010-part-3-focus-and-activation.aspx. I encourage you to take a look at it.
Please let me know if you have any other questions or concerns on this matter.
Sincerely,AndrewAssociate DeveloperInfragistics Inc.www.infragistics.com/support
Don't worry about the ribbon groups. It is not issue I need help with. We have an attached behavior that when a control gets focus, it will make a ribbon group visible. When it loses focus, it will hide the ribbon group. By making all the pane's share focus scope, then I can easily track logical focus instead of keyboard focus. The other part to this is we do all our bindings on LostFocus. This means that when the end user clicks save, we have to simulate a lost focus to get the data pushed up. With different focus scopes on the content pane, it makes things much more challenging.
What is interesting about setting the focusscope to false is that it works correctly when not floated. It technically works correctly when floated too, meaning the panes across multiple windows seem to share the same focus scope. The main issue I am trying to solve is the broken tabbing functionality. It works fine if I used XamTextEditor, or XamComboBox, but not with TextBox or ComboBox.
I have already read that MSDN thread. It got me part of the way to my current solution. In order to get the ribbon to work from floated pane's i had to do some similar things to what is in that thread. Handling PreviewGotKeyboardFocus in the ribbon. I also had to explictely set CommandTargets to Keyboard.FocusedElement on all my routed commands. I then had to have my floated pane's route all events up through the XamDockManager.
I wireup to MainDockingManager.ToolWindowLoaded += MainDockingManager_ToolWindowLoaded;