@@ -25,6 +25,7 @@ public sealed partial class Properties : Page
2525 private static ApplicationViewTitleBar TitleBar ;
2626
2727 private CancellationTokenSource tokenSource = new CancellationTokenSource ( ) ;
28+ private ContentDialog propertiesDialog ;
2829
2930 private object navParameter ;
3031
@@ -35,6 +36,7 @@ public sealed partial class Properties : Page
3536 public Properties ( )
3637 {
3738 InitializeComponent ( ) ;
39+ propertiesDialog = Interaction . FindParent < ContentDialog > ( this ) ;
3840 }
3941
4042 protected override void OnNavigatedTo ( NavigationEventArgs e )
@@ -63,7 +65,6 @@ private async void Properties_Loaded(object sender, RoutedEventArgs e)
6365 }
6466 else
6567 {
66- var propertiesDialog = Interaction . FindParent < ContentDialog > ( this ) ;
6768 propertiesDialog . Closed += PropertiesDialog_Closed ;
6869 }
6970 }
@@ -125,6 +126,7 @@ private void PropertiesDialog_Closed(ContentDialog sender, ContentDialogClosedEv
125126 tokenSource . Dispose ( ) ;
126127 tokenSource = null ;
127128 }
129+ propertiesDialog . Hide ( ) ;
128130 }
129131
130132 private void Properties_Unloaded ( object sender , RoutedEventArgs e )
@@ -178,7 +180,6 @@ private async void OKButton_Click(object sender, RoutedEventArgs e)
178180 }
179181 else
180182 {
181- var propertiesDialog = Interaction . FindParent < ContentDialog > ( this ) ;
182183 propertiesDialog . Hide ( ) ;
183184 }
184185 }
@@ -191,7 +192,6 @@ private async void CancelButton_Click(object sender, RoutedEventArgs e)
191192 }
192193 else
193194 {
194- var propertiesDialog = Interaction . FindParent < ContentDialog > ( this ) ;
195195 propertiesDialog . Hide ( ) ;
196196 }
197197 }
@@ -206,7 +206,6 @@ private async void Page_KeyDown(object sender, KeyRoutedEventArgs e)
206206 }
207207 else
208208 {
209- var propertiesDialog = Interaction . FindParent < ContentDialog > ( this ) ;
210209 propertiesDialog . Hide ( ) ;
211210 }
212211 }
0 commit comments