Dock Panel component for .NET that allows docking inside tab-pages?
Asked Answered
F

4

11

I want to build a user-interface that, for historical reasons, has a lot of "columns" of information. Many of these aren't relevant for all users in all cases, so I thought I'd look at dock panels to allow the users to hide or rearrange the columns according to their job scenario.

This is Winforms in .NET 3.5.

As such, I'd like the following:

  • Have tab-pages in the main form
  • Each tab-page can have dock-panels docked into them
  • Dock-panels should be movable from one tab-page to another

Example mockup http://images.vkarlsen.no/so/2902953/dock-test.png

I've tried the following component packages so far without luck:

Telerik

Allows me to dock inside a tab-page, but dock-panels can't move from one tab-page to another. When attempting to drop a floating panel onto a different tab-page than the one it came from, it appears the dock will succeed, but when dropped it is docked on its owner container.

Divelements SandDoc

Same problems as with Telerik.

DevExpress XtraBars

Same problems as with Telerik.

http://sourceforge.net/projects/dockpanelsuite/

Same problem, a dock content window can only belong to one dock panel, which means it cannot migrate from one tab to another.


Basically, does anyone know of any such component (package) that would allow me to do what I want?


Edit: Ok, I have tried getting the Sourceforge control above working, but I can't see how to make this work.

Basically, here's what I need done:

  1. I need to have multiple tab-pages (I don't need to undock these, they can be static)
  2. I need to be able to dock content into the tab-pages
  3. I need to be able to move content from one tab-page to another

If I understand the answer below that mentions this control, I should use DockPanel instead of TabControl, and DockPane instead of TabPage, but as far as I can tell, this only gives me the ability to dock and undock tab-pages, and that's not what I want.

Anyway, here's a program file, just create a Winforms project, add a reference to the .dll from the sourceforge project and paste in this code in Program.cs:

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

namespace DockTest
{
    public class DockWindow1 : DockContent
    {
        public DockWindow1()
        {
            TabText = "Dock-window #1";

            DockPanel panel = new DockPanel();
            panel.Dock = DockStyle.Fill;
            Controls.Add(panel);

            // tried this related to the exceptions
            // this.DockPanel = panel;
        }
    }

    public class DockWindow2 : DockContent
    {
        public DockWindow2()
        {
            TabText = "Dock-window #2";

            ListBox lb = new ListBox();
            Controls.Add(lb);
            lb.Dock = DockStyle.Fill;
            lb.Items.Add("Listbox");
        }
    }

    public class MainForm : Form
    {
        public MainForm()
        {
            DockPanel panel = new DockPanel();
            panel.Dock = DockStyle.Fill;
            panel.DocumentStyle = DocumentStyle.DockingWindow;
            Controls.Add(panel);

            // exceptions here
            DockPane dp = panel.DockPaneFactory.CreateDockPane(
                new DockWindow1(), DockState.Document, true);
            dp.AllowDockDragAndDrop = true;
            dp.AllowDrop = true;

            DockWindow1 w1 = new DockWindow1();
            w1.Show(panel);

            DockWindow2 w2 = new DockWindow2();
            w2.Show(panel);
        }
    }

    static class Program
    {
        [STAThread]
        static void Main()
        {
            Application.Run(new MainForm());
        }
    }
}
Fullbodied answered 25/5, 2010 at 8:2 Comment(2)
did you ever figure this out? Im having a very similar issue, I need everything you need except for moving from tab to tab.. Also the tabs MUST stay staticJugum
any final solution with full source code?Albion
J
6

Try this.

http://sourceforge.net/projects/dockpanelsuite/

EDIT

You can try DockPane instead of Tabs if at all possible. DockPane will let you move elements from one Pane to another.

1.DockPanel replaces TabControl
2.DockPane replaces TabPages

DockPane dp = dockPanel.DockPaneFactory.CreateDockPane(new DockForm(), DockState.Document, true);
dp.AllowDockDragAndDrop = true;
dp.AllowDrop = true;
Jerryjerrybuild answered 25/5, 2010 at 8:26 Comment(3)
It has the same problem, dock panels belong to a single dock target, cannot migrate from one tab to another.Fullbodied
I'll try the dockpanes instead of tabs.Fullbodied
I still don't get how I can get this working, I will edit my question with some source code for a test-program, can you take a look and see if you spot my mistake?Fullbodied
T
1

Try Devcomponents.com

Traceetracer answered 25/5, 2010 at 13:48 Comment(0)
P
0

Try to do the following (my telerik sample):

  1. Add DockingManager from toolbox
  2. In codebehind do the following:

    DockPanel dockPanel = new DockPanel();
    dockPanel.Text = "My Panel";
    dockPanel.Dock = DockStyle.Fill;
    //Add Dock Panel To Manager
    dockingManager1.SetDocument(addProdDockPanel);

Phagocyte answered 29/7, 2010 at 12:11 Comment(0)
P
-1

In .Net you would programmatically move the control (DockPanel) from one control container (Tab) to the other. Accomplishing this using drag and drop functionality.

Pes answered 6/10, 2011 at 2:36 Comment(1)
It actually helps to read the question. There aren't dock panels built into .NET, the question was if there was any 3rd party controls that allowed for the scenario. My question was basically "Does anyone know of any 3rd party controls that does this" and your answer is basically "Just do it".Fullbodied

© 2022 - 2024 — McMap. All rights reserved.