Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AvalonDock : Programmatically undock DocumentContents of DocumentPan

Tags:

wpf

avalondock

Hi I was wondering if I could undock all DocumentContents of a DocumentPan programmatically .

any Suggestions?

Thank you.

like image 498
Mohsen Avatar asked Mar 04 '26 10:03

Mohsen


1 Answers

I've spend couple of hours on this problem and found following solution. I downloaded avalon's source code and modified it. I've made two modifications. The first one in DocumentPane class:

public void UnDock(DockableContent content)
    {
        DockingManager manager = GetManager();
        Point point = this.PointToScreenDPI(new Point(0, 0));
        manager.Drag(content, point, new Point(0, 0));
        manager.CompleteDragging(point);
    }

And the second, I extent visibility of CompleteDragging method from private to internal.

Usage of UnDock is quite simple:

dockumentPane1.UnDock(dockablePane1.Items[0] as DockableContent);

Of course DocumentPane should contain some DockableContent and it should be exactly DockableContent not DocumentContent. It seems work fine for me ;)

like image 198
Code Ars Avatar answered Mar 08 '26 08:03

Code Ars



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!