我正在尝试使用从http://wpfmdi.codeplex.com/下载的外部dll的wpdmdi在wpf中创建mdi应用程序。
1我有一个主窗口,其中包含菜单和 mdiconatiner , xaml 的代码位于
之下<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
xmlns:mdi="clr-namespace:WPF.MDI;assembly=WPF.MDI"
x:Class="Cheque.AccountSetup"
Title="Main Window"
MinHeight="480"
MinWidth="800"
VerticalAlignment="Stretch"
HorizontalAlignment="Stretch"
WindowState="Maximized">
<ScrollViewer HorizontalScrollBarVisibility="Auto"
VerticalScrollBarVisibility="Auto">
<Grid x:Name="LayoutRoot"
HorizontalAlignment="Stretch">
<Grid.RowDefinitions>
<RowDefinition Height="31*" />
<RowDefinition Height="473*" />
</Grid.RowDefinitions>
<telerik:RadMenu HorizontalAlignment="Stretch"
Height="28"
VerticalAlignment="Top"
FontSize="14">
<telerik:RadMenuItem Header="Setup">
<telerik:RadMenuItem Header="Account Set up"
Click="AccountSetup_OnClick" />
<telerik:RadMenuItem Header="Cheque Design Template" />
<telerik:RadMenuSeparatorItem />
<telerik:RadMenuItem Header="Bank Name" />
</telerik:RadMenuItem>
</telerik:RadMenu>
<mdi:MdiContainer Name="Container"
Theme="Generic"
Margin="0,28,0,0"
Grid.RowSpan="2">
<mdi:MdiChild Name="ChildWindowContent"
WindowState="Maximized" />
</mdi:MdiContainer>
</Grid>
</ScrollViewer>
</Window>
2打开用户控件的代码是
UserAccountSetup ase =new UserAccountSetup();
ChildWindowContent.Content = ase;
3我在userAccountSetup UserControl中有关闭按钮用于关闭usercontrol
AccountSetup mainWind = Application.Current.MainWindow as AccountSetup;
if (mainWind != null) mainWind.Container.Children.RemoveAt(0);
4按下退出按钮时用户控件关闭,但当我再次尝试从菜单打开用户控件时,它不会打开,也不会出现任何错误。
请帮我解决这个问题
我正在使用vs2013和.net 4.5