I have DockManager -> SplitPane -> TabGroupPane with multiple tabs.
When I pull a Tab to floating & then dock it back again, it is added back to the first position in the collection of Tabgroups.
How would I add the tab to the same Index when I dock a floating tab?
Tab A, Tab B, Tab C (In this order)
When I float Tab C and dock it back to the DockPanel, it is added to 1st index (Tab C, Tab A, Tab B), but I would like to maintain the order Tab A, Tab B, Tab C without having to drag tabs after docking.
Hello Prashanth,
Thank you for posting. You can set the ‘NavigationOrder‘property' to either ‘ActivationOrder’ or ‘VisibleOrder’ enums, to control the order in which panes are navigated.
Let me know if you have any question.
-Divya Jain
That did not solve my problem. I tried both ActivationOrder & Visible Order.
In the following case....If I float "Three" & then dock it back to the TabGroup, I want the order to be maintained. In my case "Three" shows up first in the list.
<igDock:XamDockManager NavigationOrder="VisibleOrder"> <igDock:DocumentContentHost> <igDock:SplitPane> <igDock:TabGroupPane> <igDock:ContentPane Header="One" /> <igDock:ContentPane Header="Two" /> <igDock:ContentPane Header="Three" /> <igDock:ContentPane Header="Four" /> <igDock:ContentPane Header="Five" /> </igDock:TabGroupPane> </igDock:SplitPane> </igDock:DocumentContentHost></igDock:XamDockManager>
Thank you for the update. I discussed the matter with the development team and find that the behavior you described, about floating tab added at the first position is something by design.
Although you can work around it by using the PaneDragEnded and ExecutedCommand event (on each pane ) and reorder them something like this:
private void XamDockManager_PaneDragEnded(object sender, Infragistics.Windows.DockManager.Events.PaneDragEndedEventArgs e) { //This will only work if dragging one pane at a time. ContentPane pane = e.Panes[0] as ContentPane; if (pane.PaneLocation == PaneLocation.Document) { int tag = int.Parse(pane.Tag.ToString()); if (tag != 0) { ReorderPanes(host, pane, tag); } } } private void ContentPane_ExecutedCommand(object sender, Infragistics.Windows.Controls.Events.ExecutedCommandEventArgs e) { if(e.Command.Name == "ChangeToDocument") { ContentPane pane = sender as ContentPane; int tag = int.Parse(pane.Tag.ToString()); if(tag != 0) { ReorderPanes(host, pane, tag); } } } public void ReorderPanes(DocumentContentHost dch, ContentPane pane, int desiredIndex) { var tgp = LogicalTreeHelper.GetParent(pane) as TabGroupPane; if (tgp == null) return; int indexOf = tgp.Items.IndexOf(pane); if(indexOf != desiredIndex) { List<int> currentOrderTags = new List<int>(); for(int i=0; i < tgp.Items.Count; i++) { ContentPane cp = tgp.Items[i] as ContentPane; // int tag = int.Parse(cp.Tag.ToString()); int tag = cp == null ? 0 : int.Parse(cp.Tag.ToString()); currentOrderTags.Add(tag); } List<int> minTags = currentOrderTags.Where(i => i < desiredIndex).ToList(); List<int> maxTags = currentOrderTags.Where(i => i > desiredIndex).ToList(); if (minTags.Count == 0) //Add to beginning { tgp.Items.Remove(pane); tgp.Items.Insert(0, pane); } else if (maxTags.Count == 0) //Add to end { tgp.Items.Remove(pane); tgp.Items.Insert(tgp.Items.Count, pane); } else //Both exist, so need to add between { int minTag = minTags.Last(); int indexOfMinTag = minTags.IndexOf(minTag); tgp.Items.Remove(pane); tgp.Items.Insert(indexOfMinTag + 1, pane); } }
I also attached the modified sample for your reference.
Let me know if you need further assistance.
-Divya
XamDockManagerPaneOrderSample.zip