I've been playing with the XAMDockManager to get it to provide a simple tab control with four or five content tabs that can be "popped out" into their own windows that can be positioned (and layout saved). I'd like to disable any docking ability save the switch between a floating window and a tab item in the control. If the user pops out a tab item to a floating window the user can "close it" which would dock it back into the original tab control.
The XamDockManager has all the nifty support I need, floating windows, layout persistence tc, but I can't figure out how to do a few things:
(a) disable all docking, don't want split panes or anything else.
(b) hide the close button and the "file menu" displayed in the document content host tab right hand side.
(c) detect that change in state of a content pan from docked in the document content host to being a floating window. This would help me to toggle the state of the allow close field which would be disabled when a tab, but enabled when a floating window. when the floating window is closed it would redock the content pane to the document content host
I haven't yet looked at adding the "pop out" icon to the tab. I expect to be able to style the content pane header to make this happen.
Can someone point me to examples to help with these items?
Thanks.
Awesome! Glad to help.
That did the trick.
Thanks for the quick response.
Hi dcg1212,
There are two things you will need. The first is that in order to change from docked to floating, the ToggleDockedState command needs to be used. So after you execute the ChangeToDockable command, execute the ToggleDockedState command. Both of these together will do the trick.
The second requirement is that the pane's IsPinned property must be true. One of the restrictions for using ToggleDockedState is that the ContentPane must not be unpinned. Since your panes are in a DocumentContentHost they cannot be unpinned anyway so leaving IsPinned="True" or not setting it at all will not effect your requirements.
These two changes should get you the desired behavior.
Thanks Rob. That's what I needed. I'm still having a sport of trouble however.
Spent the last few hours figuring out a few things, and I'm stuck on the last item which to add an a button to the headers of the items that can be popped out. Click it, it changes the document to a floating window.
I've been reading a bunch, but just can 't see to figure out how to accomplish what I need.
I've updated the controltemplate for the Panetabitem (yes its really ugly), and added a button that when clicked executes a ButtonBase_OnClick.
All seems to work, buttons is clicked, event handler is run, it finds the panetabitem and then tried to raise contentPane to a floating item. But the command does nothing.
I'm sure I'am missing something, just what I don't know.
I've attached my test project to see if it is something peculiar to what I am doing elsewhere.
I'd appreciate and suggestions you might make. If there is a better way to accomplish this I'd love to see it as well.
Here's the button click handler, where most of the problem might be.
If you want to disable any kind of docking then you can set the AllowDocking property on the ContentPane. This won't let users drag the panes out though. In order to accomplish this, I allowed docking but I handled the PaneDragOver event and set the IsValidDragAction to false when ever certain dragging actions occur. This allows you to specify how to restrict the drag docking.
To hide the close button and file menu button, I create a style that used the same key as the default style so that it overwrote the style. I then set the Visibility property to collapsed.
In order to detect the change in state of a docked ContentPane to a floating pane, you can handle the ToolWindowLoaded event. This event will fire whenever the ToolWindow (floating window) appears. I then handled the Closing event on this ToolWindow and canceled it when the user clicked on the close button. This allowed me to remove the ContentPane from the ToolWindow and re-add it back to the TabGroupPane in the DocumentContentHost.
Let me know if you have any questions.