开发者

WPF Window Docking

I am having multiple windows( .xaml files).开发者_Go百科 I want to dock one window in other.

Say, I am having a ParentWindow.xaml. On a button click in ParentWindow I open ChildWindow.xaml. After opening ChildWindow.xaml, I have to dock it in the ParentWindow.xaml.

How to implement this?


have a look at this library: http://www.codeproject.com/KB/WPF/WPFdockinglib.aspx


I think what you are looking for is an MDI interface. This is not possible in WPF : children of a window cannot be windows, they can only be controls.

Instead, you could change your ChildWindow to be a UserControl and display it in a TabControl. Most modern UI now use tabs rather than MDI...


Do you wanna docking just like widget in your MainWindow or wanna dock its contents in MainWindow UIElement?

Lets try this in mainwindow.xaml.vb:

Dim NewMyWinChild As Window2 = New Window2()
Dim TheMyContent As Object = NewMyWinChild.Content
GridNameOfMyUIElemnt.Children.Add(TheMyContent)

This will Add the content of Window2 to GridNameOfMyUIElemnt-mainwindow.xaml on Runtime.

I think if you want widget then you can set "Z-panel index" properties.

MDI, yes it can, just googling but it old.

(It works fine with me in VB 2005 express with .Net 3.0)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜