Calling up DockPanel-Suite's "AutoHidden" DockContent programmatically

Posted by Lockszmith on Stack Overflow See other posts from Stack Overflow or by Lockszmith
Published on 2012-12-12T15:56:24Z Indexed on 2012/12/12 17:03 UTC
Read the original article Hit count: 642

Filed under:
|
|

I am having trouble causing an 'autohide' dock to appear programmatically.

Couldn't find any answer around the net, though the following SO Question suggested that .Show() should have done the trick

I've tried this on the latest NuGet version of the code.

My test code is below.

Anyone know how to do it? or what I'm doing wrong?


My test Code

Create a simple Visual Studio Windows Form application, and replace the main form's source file content with this code:

using System;
using System.Windows.Forms;
using dps = WeifenLuo.WinFormsUI.Docking;

namespace testDockPanel
{
    public partial class Form1 : Form
    {
        private dps.DockPanel dockPanel;
        private dps.DockContent dc;
        private Control innerCtrl;

        public Form1()
        {
            InitializeComponent();

            dockPanel = new dps.DockPanel();
            dockPanel.Dock = DockStyle.Fill;
            dockPanel.DocumentStyle = dps.DocumentStyle.DockingWindow;

            toolStripContainer1.ContentPanel.Controls.Add(dockPanel);

            dc = new dps.DockContent();
            dc.DockPanel = dockPanel;
            dc.DockState = dps.DockState.DockRightAutoHide;
            innerCtrl = new WebBrowser() { Dock = DockStyle.Fill };
            dc.Controls.Add( innerCtrl );

            // This SHOULD show the autohide-dock, but NOTHING happens.
            dc.Show();
        }
    }
}

© Stack Overflow or respective owner

Related posts about c#

Related posts about winforms