When un-docking a tab (ContentPane) the tab that is selected is not the last selected tab.
For example, if there were 4 tabs ( A, B, C y D).
It is always the tab selected before the last one that gets selected. This is not consistent with Visual Studio Behavior.
Is this a bug? Can the XamDockManager be configured so the tabs get selected correctly, and always the last tab is the one left selected on the group?
Thank you!
Hello Dzyann,
Thank you for your post. I have been investigating into this issue, and I have reproduced the behavior that you are referring to. Interestingly, it only appears to exist when the TabGroupPane is hosted in a DocumentContentHost in the XamDockManager. I will be investigating into this a bit further with my colleagues and I will have more information for you very soon on this matter.
Sincerely,AndrewAssociate DeveloperInfragistics Inc.www.infragistics.com/support
It appears that this issue is being caused because the TabGroupPane is raising two "selection changed" notifications when you float a pane when the TabGroupPane is hosted in a DocumentContentHost. I have found that the previous pane is being selected correctly at first, but then on the second call, the next-previous pane gets selected, and this happens too quickly to see, so it appears that just the next-previous pane is the only one being selected.
After some research and investigation, I have devised a workaround for this behavior. You will need to keep track of the tabs that are selected for this to work, and to do that I would recommend creating a List<ContentPane> and handling the SelectionChanged event on the TabGroupPane. If the item at e.AddedItems[0] is not null and is a ContentPane, add it to this collection. Then, using a Dispatcher, you can check the e.RemovedItems collection. If e.RemovedItems[0] is not null, is a ContentPane, and the panes location is PaneLocation.Floating, then the user has floated one of the tabs of the TabGroupPane. At this point, the double "selection change" will have already happened, so the pane that you want selected will be at the index of ListOfContentPanes[ListOfContentPanes.Count - 2]. You can then set the TabGroupPane.SelectedItem property to the content pane at that index and your last-selected content pane will be selected on float of a tab in the TabGroupPane.
I have attached a sample application to demonstrate the above. I am also continuing to investigate this matter to determine if this is a bug or not. I believe it likely is, but I would like to make sure.
Please let me know if you have any other questions or concerns on this matter.