Hello
I would set focus at the same time i set visible a ContextualTabGroup. How can i do that?
Thanks
A contextualtabgroup is not a focusable element. The elements that represent the ContextualTabGroup are dynamically created by the RibbonCaptionPanel.
Thanks for your answer
Exact, i have found a solution with tabitem by adding this on the creation of the pane :
pane.GotFocus += delegate{this.mainRibbon.SelectedTab = this.PersonneTab;};
personneTab is a tabItem.
It works when a control in the pane got the focus, but it will perfect if the event is raised when i select the pane with the mouse or the keyboard.
Sorry I guess I misunderstood your original post. You were just trying to determine when focus was put in a RibbonTabItem not trying to give focus to a ContextualTabGroup which is what I understood your original post to mean.
Many thanks Andrew, with ActivePaneChanged, it's working fine.
Its hard to say from what you have listed but if the contentpanes are documents (i.e. within a DocumentContentHost) then maybe you could use the ActiveDocument property to determine which pane to consider active and therefore which contextual tab group to select. Another option might be to use the ActivePaneChanged and when the ActivePane is non-null then select the tab of the contextualtabgroup associated with the pane.
Thanks for your answer Andrew.
I'm Ok with SelectedTab. But my question is a little bit different. For example, I have two different contentPane. When i instanciate the first, I set the property IsVisible of his ContextualTabGroup to true and set the selectedtab of the ribbon to the first tab of this ContextualTabGroup.I instanciate the second and make the same things. Then the selectedTab is now the first tab of the second ContextualTabGroup.If i click on the first pane, or give it focus, i want that the selectedTab become the first of the first ContextualTabGroup.At this time, I use this event of the pane : KeyDown, MouseDown or Focus and it works but not all the time. I need an event which permit this.
I'm sorry but I still don't follow what the problem is. Just making a contextualtabgroup visible (which is all the code you listed is doing) does not select a tab from that. You would have to set the SelectedTab property of the XamRibbon to the tab you want to select. If you still have a problem then it would be best if you contact the support group, provide a sample that demonstrates the problem and specific steps on how to reproduce the problem when running the sample so they can look into the issue.
Any idea?