Can a WPF window host another WPF window?

D

Dean Slindee

I am not looking for a "hybrid" WPF/WinForm or WinForm/WPF solution, but
rather a pure WPF/WPFsolution.

I want to host a WPF window inside another WPF window. I want to host a WPF
window as a "control" inside another WPF window, much like a button is
hosted inside a WPF window. This may not be possible today in WPF, but that
is what I am trying to determine. Since WPF is a 1.0 product, perhaps the
answer is: wait for a more complete WPF to be released in the future.
Anybody know?

I dock Windows forms inside of Windows forms in *all* my projects, sometimes
4 or 5 window levels deep. Without this capability in WPF, WPF is mostly a
non-starter for me.
 
C

Chris Dunaway

I dock Windows forms inside of Windows forms in *all* my projects, sometimes
4 or 5 window levels deep. Without this capability in WPF, WPF is mostly a
non-starter for me.

How are you doing that in Window Forms? Are you setting the parent of
one form to another and then setting the TopLevel property to false
before calling Show? What advantage does this give you over using,
say, a User Control? For what reason do you require your apps to be
this way?

That being said, I don't believe that a Window can be hosted inside a
Window, at least not like you would do with a Windows Form as in non-
WPF apps. I tried to do it with a simple test but was unable. That
doesn't mean it can't be done, just I couldn't figure it out in 5
minutes! You can instantiate other Windows as child windows by
setting the Owner property, but I don't think they can actually be
embedded within the main Window.

When using WPF, you have to change the way you think about application
design. If you could describe the reason for hosting forms in forms,
maybe there is a more WPF way to do it.

Chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top