Home Forums WinForms controls Other WinForms controls Docking windows – adding a tool window in autohide state

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #18393 |

    I am trying to add a docked window to a form which is created with its state set to auto hide. This works fine if the dock position is not set; the tab is there as expected on the left side of form. However, I need it on the right.

    After using DockTo with the dock position set to right the tool window appears pinned. Is there any way please to unpin it programmatically?

    I’m currently evaluating docking windows so imagine I have missed many things.

    Imported from legacy forums. Posted by Nigel (had 4759 views)

    Xceed Support
    Member
    Post count: 5658

    When I tested this, the ToolWindow is not set to AutoHide mode.

    <code>
    private void Form1_Load( object sender, EventArgs e )
    {
    MyToolWindow tw1 = new MyToolWindow();
    tw1.Key = “tw1”;

    MyToolWindow tw2 = new MyToolWindow();
    tw2.Key = “tw2”;

    dockLayoutManager1.ToolWindows.Add( tw1 );
    dockLayoutManager1.ToolWindows.Add( tw2 );

    tw2.DockTo( DockTargetHost.DockHost, Xceed.DockingWindows.DockPosition.Right );
    }
    </code>

    To be sure it’s not in AutoHide mode, you can set the State of the ToolWindow in Docked mode.

    <code>
    tw2.State = ToolWindowState.Docked;
    </code>

    Imported from legacy forums. Posted by CharlesB (had 289 views)

    User (Old forums)
    Member
    Post count: 23064

    Thanks for your reply, but that is not what I meant. Sorry for the confusion. I think I do want the mode to be AutoHide (if my understanding of AutoHide is correct) but I want the tool window tab to be positioned on the right of the main form.

    If I continue your example and after
    tw2.DockTo(DockTargetHost.DockHost, DockPostion.Right);
    which pins the window on the right of the form add:

    tw2.State = ToolWindowState.AutoHide;
    its tab appears on the left of the form.

    So, what I really mean to ask is how to set up a tool window (or windows) that are not just docked to the right but “reside” there, but also keeping others on the left (as in Visual Studio). We have a MDI application so do not have the ability (I think) to make the DockTargetHost some ClientHost.

    Imported from legacy forums. Posted by Nigel (had 543 views)

    User (Old forums)
    Member
    Post count: 23064

    I ought to add that if docked on the right, manually unpinning the window causes the tab to be aligned right.

    I’ve found a workaround (not perfect): by separating the AutoHide from the main form’s constructor. If the docking happens in the constructor and the Autohide state is set in the Load (or Shown) event then the tab is right aligned but the downside is that it can be seen closing.

    If the whole process, docking and state change, is moved to the Load (or Shown) events then the effect is the same as having it all in the constructor – left alignment. It seems then that having the docking and state set together effectively undoes the dock position and reverts to the default (?) left position.

    Imported from legacy forums. Posted by Nigel (had 430 views)

    User (Old forums)
    Member
    Post count: 23064

    I’m slowly getting to understand this (I think). Both Docked and AutoHide are States and DockTo sets the State to Docked. It seems to me that layout and state should be separated. The two concepts seem to have become confused in the design. Apologies if I’m missing something.

    Imported from legacy forums. Posted by Nigel (had 5364 views)

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.