Malu
Malu

Reputation: 21

WPF Window Docking

I am having multiple windows( .xaml files). 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?

Upvotes: 2

Views: 6223

Answers (3)

Bobo
Bobo

Reputation: 1

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)

Upvotes: 0

Thomas Levesque
Thomas Levesque

Reputation: 292725

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...

Upvotes: 0

Tony The Lion
Tony The Lion

Reputation: 63310

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

Upvotes: 4

Related Questions