用了一段时间的WPF,居然发现WPF不支持MDI窗体!这么重要的功能微软居然给忽略了? 微软的开发团队解释:因为WPF带来革命性的窗口布局的新特性,所以不希望再看到 the overlapping windows within a window. 但我个人还是觉得MDI能非常直观迅速的表达软件的功能。所以提供了一个解决的办法如下:
第一步. 建一个MainWindow.xaml 的窗体作为主窗体
XAML:
<DockPanel HorizontalAlignment="Stretch" Margin="0,0,0,0" Width="Auto" MinWidth="500" MinHeight="200">
<GroupBox DockPanel.Dock="Left" Width="100" Height="Auto" Header="Menu">
<StackPanel>
<Button x:Name="Child1" Tag="Child1" Content="子窗体1" Margin="3" Click="Child1_Click"/>
<Button x:Name="Child2" Tag="Child2" Content="子窗体2" Margin