AvalonDock dock a window

十年热恋 提交于 2019-12-02 04:36:39

问题


I am trying to convert my app in WPF to work with AvalonDock. I have a few windows(about 10) and main form that has DockingManager. I would like to put those windows inside that DockingManager. I've tried this:

<ad:DockingManager x:Name="MainWindow">
    <ad:DocumentPane x:Name="Windows" />
</ad:DockingManager>

FormDocumentSearch formDocumentSearch = new FormDocumentSearch(dc, this); //create window
DockableContent dct = new DockableContent() { Title = "Window" }; //create DockableContent
dct.Content = formDocumentSearch; //put the window in the DockableContent
Windows.Items.Add(dct); 

This gives me the following error: Window must be the root of the tree. Cannot add Window as a child of Visual..

What can I do? How can I put a Window or how to modify them so that I can still use the designer and have them in AvalonDock?


回答1:


I dont think you can add a window in side another window. Try to change window as Page.

change

<Window ... >

...

</Window>

to

<Page ... >

...

</Page>

For all windows you wanted to add as child.



来源:https://stackoverflow.com/questions/1772768/avalondock-dock-a-window

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!