|
|
Questions and answers for Application and Deployment Window.
|
45. Application and Deployment Window
|
| 45.1 How
do I create a child window in WPF ?
|
| 45.2 How
do I host Windows Forms control in a WPF Window ?
|
| 45.3 Does
WPF support MDI ?
|
45.1 How do I create a child window in WPF ?
|
|
In WPF, any of the windows can be designated as child windows. A child window is
like any other window but it gets minimized or closed when the parent is
minimized or closed respectively. This type of window is called modeless
dialog. To make a window a child of another window, the "Owner" property of the
child window has to be set as the parent window but only after the parent
window is shown. Child windows of a window can be enumerated using the
"OwnedWindows" read-only property.
|
45.2 How do I host Windows Forms control in a WPF Window ?
|
|
Windows forms can be hosted using the WindowsFormsHost markup extension of the
"windowsformsintegration.dll". References for "windowsformsintegration.dll" and
"System.Windows.Forms.dll" have to be added.
The following code snippet is used to add a control to the Windows Forms.
Note: windowsformsintegration.dll will be available in the following location,
Program files\Reference
Assemblies\Microsoft\Framework\v3.0\WindowsFormsIntegration.dll.
|
[XAML]
<WindowsFormsHost>
<wf:MaskedTextBox x:Name="mtxamt" Mask="00000.00"/>
</WindowsFormsHost>
|
45.3 Does WPF support MDI ?
|
|
No. WPF from version 1 does not include support for MDI. If there is a need for
MDI in your application, you can use the windows forms interop or create a
custom child window manager.
|
|