This is a migrated thread and some comments may be shown as answers.

Floating a Document - Example

1 Answer 159 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Phillip
Top achievements
Rank 1
Phillip asked on 17 Aug 2009, 08:17 AM
Hi,

I am trying to provide my user with a "open in new window" capability from the RadDock interface. The user will generally open new screens in new tabs but there is an extra button which will allow them to "float" any particular tab so it becomes an independent window.

I'm guessing the best way to achieve this within the RadDock framework is to create a new floating ToolWindow for the Document when the user presses the "open in new window" button. This way we can allow them to re-dock it to the DockManager later if they wish.

My approach would be

ToolWindow tw = new ToolWindow; // create the new toolwindow
tw.CloseAction = CloseAndDispose; // I always do this.
this.documentTabStrip.ControlsAdd(tw); // Add the toolwindow to the tab strip.
this.radDock.ActiveWindow.Parent = tw; // Switch the parent of the current document to the toolwindow
tw.Float(new Rectangle(0,0,500,500)); // Float the new toolwindow

Unfortunately it doesn't seem that simple. I got a couple of problems doing this;
1) The change of parent for a large form (40-50 textboxes) takes a long time, and causes visual flickering and glitching.
2) The transferred DockWindow is not dock.Fill inside the ToolWindow. It retains the size it was at the point where ownership was transferred. I can't seem to find a way of getting the transferred DockWindow to resize itself when transferred.
3) The transferred DockWindow seems to have a blank TabItem associated with it, so doesn't visually work - it leaves  gap for displaying the tab at the top of the toolwindow.

Subsequently I changed my approach to transfer the internal top level control for the DockWindow rather than the DockWindow itself, like this;

ToolWindow tw = new ToolWindow();
tw.CloseAction = CloseAndDispose;
Control controlToBeTransferred = this.radDock.ActiveWindow.Controls[0]; // Assumes a containerControl at top level.
ths.documentTabStrip.Controls.Add(tw);
controlToBeTransferred.Parent = tw;
tw.AutoScroll = true;
this.radDock.ActiveWindow.Close(); // It no longer has anything in it.
tw.Float(new Rectangle(0,0,500,500));

And this seems to work fine now. Thought the Forum would be interested.

1 Answer, 1 is accepted

Sort by
0
Nick
Telerik team
answered on 19 Aug 2009, 08:25 AM
Hi Phillip,

Thank you for sharing with the community your solution. I have updated your Telerik points.

All the best,
Nick
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Dock
Asked by
Phillip
Top achievements
Rank 1
Answers by
Nick
Telerik team
Share this question
or