Installing DockPanel Suite On Windows

By Lex Li

This page shows you how to install DockPanel Suite to your project on Windows.

In this article:

Install DockPanel Suite via NuGet

The easiest way to get started building applications with DockPanel Suite is to install via NuGet in the latest version of Visual Studio 2017 (including the free Community edition).

  1. Install Visual Studio 2017.

    Be sure to specify that you include “Windows” and “Web Development”.

  2. Install latest NuGet Package Manager .

    This will install the latest NuGet tooling.

  3. Open/create an empty Windows Forms project.

  4. Install DockPanel Suite NuGet packages following NuGet conventions .

    The latest packages can be found at,

    Note

    VS2005 Theme is moved out of main library in 3.1+.

    Warning

    Theme package version should match main library version whenever possible. Otherwise, there can be compatibility issues.

  5. Create the DockPanel control in code and insert to the main form

    public MainForm()
    {
        InitializeComponent();
    
        this.dockPanel = new WeifenLuo.WinFormsUI.Docking.DockPanel();
        this.dockPanel.Dock = System.Windows.Forms.DockStyle.Fill;
        this.Controls.Add(this.dockPanel);
    }
    

    Note

    Latest Visual Studio 2017 loads the controls from NuGet packages, so you can also drag DockPanel control from WinFormsUI Components tab in Toolbox to your form in Visual Studio design view.

  6. Create other panels by creating a new Form or new UserControl in Visual Studio

    public class NewForm : Form
    {
    
    }
    

    Change the base type to WeifenLuo.WinFormsUI.Docking.DockContent

    public class NewDockContent : WeifenLuo.WinFormsUI.Docking.DockContent
    {
    
    }
    
  7. Show the custom DockContent in DockPanel as a document

    public void ShowDockContent()
    {
        var dockContent = new NewDockContent();
        dockContent.Show(this.dockPanel, DockState.Document);
    }
    

Install DockPanel Suite via Source Code

Note

This approach requires Visual Studio 2017 and above. Please switch to NuGet package approach if you use older VS releases.

DockPanel Suite source code can be directly used in your project.

  1. Download the source code from GitHub or clone the repo directly.

  2. Open/create a empty Windows Forms project in a solution.

  3. Add WinFormsUI.csproj in WinFormsUI directory to your solution.

  4. (optional) Add other theme projects such as ThemeVS2003.csproj to your solution.

  5. Compile the solution and DockPanel Suite controls are automatically added to Toolbox panel.

  6. Open main form of the empty project, and drag the DockPanel control from Toolbox on to it.

    This will let Visual Studio generate the necessary code.

  7. Create other panels by creating new Form or new UserControl in Visual Studio,

    public class NewForm : Form
    {
    
    }
    

    Change the base type to WeifenLuo.WinFormsUI.Docking.DockContent

    public class NewDockContent : WeifenLuo.WinFormsUI.Docking.DockContent
    {
    
    }
    
  8. Show the custom DockContent in DockPanel as a document,

    public void ShowDockContent()
    {
        var dockContent = new NewDockContent();
        dockContent.Show(this.dockPanel, DockState.Document);
    }
    

Compile DockPanel Suite from Source Code

  1. Download the source code from GitHub or clone the repo directly.

  2. Install Visual Studio 2017 (like Community edition) or above.

  3. Install .NET Framework 4.0 (or above) if it is not yet installed.

  4. Install .NET Framework 3.5.1 if it is not yet installed.

  5. Run all.bat in the source code to start compilation.

If everything works, then the binaries are in the bin folder.