如何将子窗体显示为 wpf 到 MDI Container 中是正常的 mdi 窗体
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23646973/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to display a children form as wpf into MDI Container is normal mdi form
提问by Datta
How to display WPF form in normal created MDI windows form.
如何在正常创建的 MDI 窗口窗体中显示 WPF 窗体。
We create form as MDI. add menu bar click menu it will display wpf form in main container MDi form.
我们将表单创建为 MDI。添加菜单栏单击菜单它将在主容器MDi表单中显示wpf表单。


private void newStudentToolStripMenuItem_Click(object sender, EventArgs e)
{
StudentRegister student= new StudentRegister();
student.ShowDialog();
}
Problem is click on task bar child form go outside.
问题是点击任务栏子窗体出去。
回答by J R B
As my understanding you want to open child page inside MDI page. first of in WPF don't have MDI window.
据我了解,您想在 MDI 页面中打开子页面。第一个在 WPF 中没有 MDI 窗口。
if you are using " student.ShowDialog(); " then page or window will open as a popup.
如果您使用“ student.ShowDialog(); ”,则页面或窗口将作为弹出窗口打开。
possible solution:--
可能的解决方案:--
you can use ContentControl on main window and create usercontrol instead of window. then you can add user control to ContentControl.
您可以在主窗口上使用 ContentControl 并创建用户控件而不是窗口。然后您可以将用户控件添加到 ContentControl。
<Border ClipToBounds="True" Grid.Row="1" Background="WhiteSmoke">
<ContentControl x:Name="DetailsControl" Margin="10" HorizontalAlignment="Left" VerticalAlignment="Top" />
</Border>
var student= new StudentRegister ();
DetailsControl.Content = student;
below link may help.
下面的链接可能会有所帮助。
http://www.codeplex.com/wikipage?ProjectName=AvalonDock
http://www.codeplex.com/wikipage?ProjectName=AvalonDock
http://www.codeproject.com/Articles/22927/Multiple-Window-Interface-for-WPF
http://www.codeproject.com/Articles/22927/Multiple-Window-Interface-for-WPF

