Moving Panels between dockmanagers

3 posts, 0 answers
  1. kortm
    kortm avatar
    6 posts
    Member since:
    Feb 2007

    Posted 04 Apr 2007 Link to this post

    Hello,

    I have two dock managers in two different tabs and I try to move panel from one dock manager to the other.

    private void dockPanel_MoveToManager(object sender, MouseEventArgs e)

    {//MyPanel was in dockmanager2 and I want to move it to dockmanager1
    DockPanel MyPanel = (DockPanel)sender;
    this.dockingManager1.SetDock(MyPanel,DockPosition.Bottom);
    this.dockingManager2.Remove(MyPanel);
    }
    Is that possible?

    Thanks,

    KORT

  2. Vincent
    Vincent avatar
    3 posts
    Member since:
    Apr 2007

    Posted 04 Apr 2007 Link to this post

    Hello,

    you can move the panel without removing it.
    but what about its child controls?
    Any ideas on how to do that ?

    thanks,
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Julian Benkov
    Admin
    Julian Benkov avatar
    1135 posts

    Posted 04 Apr 2007 Link to this post

    Hello Vincent,

    Your code is correct, but you will need to change the order of  the Remove and SetDock calls:

    private void dockPanel_MoveToManager(object sender, MouseEventArgs e)

    {//MyPanel was in dockmanager2 and I want to move it to dockmanager1
    DockPanel MyPanel = (DockPanel)sender;

    this.dockingManager2.Remove(MyPanel);
    this.dockingManager1.SetDock(MyPanel,DockPosition.Bottom);

    }


    In this case all child controls will be safe.
     

    Kind regards,
    Julian Benkov
    the telerik team

    Instantly find answers to your questions at the new telerik Support Center
Back to Top