You can right click on a tab in the XamDockManager and toggle between a tabbed document and a floating window. How can I do this in C# so I can execute this behavior from a button click.
These actions are associated with content pane commands so you can use them, for example :
ContentPane cp = new ContentPane();
cp.ExecuteCommand(ContentPaneCommands.ChangeToDocument);
ContentPaneCommands.ChangeToFloatingOnly works to float the window but the window always comes up in the small possible size. I have tried
XamDockManager.SetFloatingLocation(pane, new Point(20, 20));
XamDockManager.SetFloatingSize(pane, new Size(300, 200));
both before and after the ExecuteCommand but the window doesn't size. How can i set the size of the floated tab window?
I added the DataTemplate (I set the background to red to easily see it) to the ToolWindow (I set in OnToolWindowLoaded) ContentTemplate. All it did was change the top line of the content in the tool window but didnt change the tool window header. The tool window doesnt have a header template, the split window doesnt have a header template, and I changed the header template of the content pane, no luck.
Where is the world is the header content for the tool window?
I gave up trying to set a template and found the original default ToolWindowPane style. That contained the pane header. From there I was able to successfully modify the the header area.
Found one more problem. After floating the content pane in the ToolWindowPane, I return it with contentPane.ExecuteCommand(ContentPaneCommands.ChangeToDocument). However, it always returns to the first Tab. If someone floats tab 8 I would like to return it to tab 8. This behavior also happens when using right click to float and return the window. I tried setting the contentPane.TabIndex but t doesnt seem to do anything.
Is it possible to reposition the returned tab back to its original position?
rkcarlin said:Is it possible to reposition the returned tab back to its original position?
No, the information about where the document was is not currently preserved. Instead when the pane is readded to the document area it is inserted as the first tab in the tabgroup containing the current active document. This was done to mimic the behavior of documents in VS 2008 and prior. You may want to submit a suggestion for preserving the document location.
I did figure out how to do this and am adding just for reference. Place the number of the tab in the tag field of the content pane then...
contentPane.ExecuteCommand(ContentPaneCommands.ChangeToDocument);
var sortList = new SortedList<int, ContentPane>();
foreach(var item in ProgramTabGroupPane.Items)
{
var pane = item as ContentPane;
if (pane == null) continue;
sortList.Add(int.Parse((string)pane.Tag), pane);
}
ProgramTabGroupPane.Items.Clear();
foreach(var pane in sortList.Values)
ProgramTabGroupPane.Items.Add(pane);
ProgramTabGroupPane.SelectedIndex = int.Parse((string)contentPane.Tag) - 1;