Setting ToolWindow Size and Location

4 posts, 0 answers
  1. Bill
    Bill avatar
    27 posts
    Member since:
    Oct 2008

    Posted 09 Sep 2010 Link to this post

    I'm using Q1 2010 SP2 and having trouble resizing and positioning a ToolWindow after it has already been created.  Here's some code I've tried:

     

     

     

     

    toolWindow.Size = new Size(400, 300);
    toolWindow.Top = Location.Y;
    toolWindow.Left = Location.X;
    toolWindow.DockState = Telerik.WinControls.UI.Docking.DockState.Floating;

     

     


    Also tried these...

     

    //toolWindow.TabStrip.SizeInfo.SizeMode = SplitPanelSizeMode.Absolute;
    //toolWindow.TabStrip.SizeInfo.AbsoluteSize = new Size(150, 0); 
      
    and 
      
    //if (toolWindow.DockingSite.HostFrom != null)
    //{
    // toolWindow.DockingSite.HostForm.Size = new Size(300, 300);
    //} 

     

     

     

    But none of these appeared to work...ideas?  Thx...

  2. Bill
    Bill avatar
    27 posts
    Member since:
    Oct 2008

    Posted 09 Sep 2010 Link to this post

    Argh!  Nevermind...looks like this one line of code does the trick...
    toolWindow.Float(Location, WinSize);
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Bill
    Bill avatar
    27 posts
    Member since:
    Oct 2008

    Posted 09 Sep 2010 Link to this post

    Sorry if I continue to ask dumb questions here but we are hurting for some documentation. Unfortunately your documentation deals with creating windows and not with how to change the state of windows that already exist

    For example, I'd like to use the DockTo method to presumably to change a DocumentPosition of a ToolWindow.  But I'm not able to find a reference to the window object needed as the first parameter of DockTo(). I only have one toolWindow (so I cannot dock to some other window as in your examples) but it already exists as a floating window.  How do I dock it!

    I see the GetDefaultDocumentTabStrip() method of RadDock. It's one line description might indicate that it could be used but can you provide and example?   If I have an application that has two modes - lets say advanced and basic - we may want different tool and document layouts based on which mode is chosen.  However we don't want to write code to save and restore all the content (which would be needed if we did a SaveLayoutToXml). In this example our content remains.  So, could you provide examples for restoring the state of windows that already exist?

    We appreciate any assistance you can provide. I know, as above, there must be some simple answers I'm overlooking...
  5. Nikolay
    Admin
    Nikolay avatar
    1804 posts

    Posted 17 Sep 2010 Link to this post

    Hi Bill,

    Thank you for the question.

    You can get a DockWindow by its name as shown below:
    toolWindow1.DockTo(this.radDock1["toolWindow2"], Telerik.WinControls.UI.Docking.DockPosition.Fill);

    You can also get a DockWindow by using one of the following collections (depending whether you want to get a DocumentWindow or a ToolWindow):
    this.radDock1.DockWindows.DocumentWindows 
    this.radDock1.DockWindows.ToolWindows

    The GetDefaultDocumentTabStrip() method gets the ActiveWindow of the DocumentManager and then returns its DocumentTabStrip. If no ActiveWindow is found, this method returns the first DocumentTabStrip found in RadDock. If there are no DocumentTabStrips in RadDock, and the parameter of the method is true, a new DocumentTabStrip is added to RadDock.

    You can find the answer of your question concerning the DockState of an AutoHide window in this forum thread.

    If there are any specific questions which come up during the process of implementing custom save/load layout functionality, feel free to contact us.

    Kind regards,
    Nikolay
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top