Hello
I would set focus at the same time i set visible a ContextualTabGroup. How can i do that?
Thanks
Yes i have bad explain my problem.
I have some contextualTabgroup whith tabItem.
When i create contentpanel, i set this contextualTabGroup visible like in your samples :
public static readonly DependencyProperty ActivePersonneProperty =DependencyProperty.Register("ActivePersonne",typeof(Personne),typeof(mainWindow),new UIPropertyMetadata(null, OnActivePersonneChanged));
static void OnActivePersonneChanged(DependencyObject depObj, DependencyPropertyChangedEventArgs e){mainWindow window = depObj as mainWindow;if (window == null || window.mainRibbon.ContextualTabGroups.Count == 0)return;ContextualTabGroup grp = window.mainRibbon.ContextualTabGroups["PersonneCxtGroup"];grp.IsVisible = window.ActivePersonne != null;}
I can have differents contentpane types whith one contextualTabGroup by type. When i click on a contentpane in the application or when i make ctrl + tab to select it, i want that the tabitem of this contextualtabgroup is selected.
With the code of my previous post, it works but not when i click on the border around the pane or on the tab of the pane.
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.
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.
A contextualtabgroup is not a focusable element. The elements that represent the ContextualTabGroup are dynamically created by the RibbonCaptionPanel.