Floating a Document - Example

2 posts, 0 answers
  1. Phillip
    Phillip avatar
    31 posts
    Member since:
    Apr 2009

    Posted 17 Aug 2009 Link to this post


    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.
    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.
  2. Nick
    Nick avatar
    767 posts

    Posted 19 Aug 2009 Link to this post

    Hi Phillip,

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

    All the best,
    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.
Back to Top