File tree Expand file tree Collapse file tree
src/TestApplications/WpfApplication Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- using System . Windows ;
1+ using System . ComponentModel ;
2+ using System . Windows ;
23using System . Windows . Controls ;
34using System . Windows . Media ;
45
@@ -9,6 +10,8 @@ namespace WpfApplication
910 /// </summary>
1011 public partial class MainWindow
1112 {
13+ private Window1 _subWindow ;
14+
1215 public MainWindow ( )
1316 {
1417 InitializeComponent ( ) ;
@@ -34,6 +37,12 @@ protected override void OnRenderSizeChanged(SizeChangedInfo sizeInfo)
3437 base . OnRenderSizeChanged ( sizeInfo ) ;
3538 }
3639
40+ protected override void OnClosing ( CancelEventArgs e )
41+ {
42+ _subWindow ? . Close ( ) ;
43+ base . OnClosing ( e ) ;
44+ }
45+
3746 private void OnShowLabel ( object sender , RoutedEventArgs e )
3847 {
3948 MenuItem menuitem = sender as MenuItem ;
@@ -68,8 +77,8 @@ private void OnDisableForm(object sender, RoutedEventArgs e)
6877
6978 private void MenuItem_Click ( object sender , RoutedEventArgs e )
7079 {
71- var window = new Window1 ( ) ;
72- window . Show ( ) ;
80+ _subWindow = new Window1 ( ) ;
81+ _subWindow . Show ( ) ;
7382 }
7483
7584 private void LabelWithHover_MouseEnter ( object sender , System . Windows . Input . MouseEventArgs e )
You can’t perform that action at this time.
0 commit comments