@@ -19,7 +19,7 @@ public WindowedContentDialog()
1919
2020 public object ? Header
2121 {
22- get => ( object ? ) GetValue ( HeaderProperty ) ;
22+ get => ( object ? ) GetValue ( HeaderProperty ) ;
2323 set => SetValue ( HeaderProperty , value ) ;
2424 }
2525
@@ -32,12 +32,12 @@ public object? Header
3232
3333 private static void OnHeaderChanged ( DependencyObject d , DependencyPropertyChangedEventArgs e )
3434 {
35- ( ( WindowedContentDialog ) d ) . _view . Header = e . NewValue ;
35+ ( ( WindowedContentDialog ) d ) . _view . Header = e . NewValue ;
3636 }
3737
3838 public DataTemplate ? HeaderTemplate
3939 {
40- get => ( DataTemplate ? ) GetValue ( HeaderTemplateProperty ) ;
40+ get => ( DataTemplate ? ) GetValue ( HeaderTemplateProperty ) ;
4141 set => SetValue ( HeaderTemplateProperty , value ) ;
4242 }
4343
@@ -50,12 +50,12 @@ public DataTemplate? HeaderTemplate
5050
5151 private static void OnHeaderTemplateChanged ( DependencyObject d , DependencyPropertyChangedEventArgs e )
5252 {
53- ( ( WindowedContentDialog ) d ) . _view . HeaderTemplate = ( DataTemplate ? ) e . NewValue ;
53+ ( ( WindowedContentDialog ) d ) . _view . HeaderTemplate = ( DataTemplate ? ) e . NewValue ;
5454 }
5555
5656 public object ? Content
5757 {
58- get => ( object ? ) GetValue ( ContentProperty ) ;
58+ get => ( object ? ) GetValue ( ContentProperty ) ;
5959 set => SetValue ( ContentProperty , value ) ;
6060 }
6161
@@ -68,12 +68,12 @@ public object? Content
6868
6969 private static void OnContentChanged ( DependencyObject d , DependencyPropertyChangedEventArgs e )
7070 {
71- ( ( WindowedContentDialog ) d ) . _view . Content = e . NewValue ;
71+ ( ( WindowedContentDialog ) d ) . _view . Content = e . NewValue ;
7272 }
7373
7474 public DataTemplate ? ContentTemplate
7575 {
76- get => ( DataTemplate ? ) GetValue ( ContentTemplateProperty ) ;
76+ get => ( DataTemplate ? ) GetValue ( ContentTemplateProperty ) ;
7777 set => SetValue ( ContentTemplateProperty , value ) ;
7878 }
7979
@@ -86,12 +86,12 @@ public DataTemplate? ContentTemplate
8686
8787 private static void OnContentTemplateChanged ( DependencyObject d , DependencyPropertyChangedEventArgs e )
8888 {
89- ( ( WindowedContentDialog ) d ) . _view . ContentTemplate = ( DataTemplate ? ) e . NewValue ;
89+ ( ( WindowedContentDialog ) d ) . _view . ContentTemplate = ( DataTemplate ? ) e . NewValue ;
9090 }
9191
9292 public object ? PrimaryButtonContent
9393 {
94- get => ( object ? ) GetValue ( PrimaryButtonContentProperty ) ;
94+ get => ( object ? ) GetValue ( PrimaryButtonContentProperty ) ;
9595 set => SetValue ( PrimaryButtonContentProperty , value ) ;
9696 }
9797
@@ -104,12 +104,12 @@ public object? PrimaryButtonContent
104104
105105 private static void OnPrimaryButtonContentChanged ( DependencyObject d , DependencyPropertyChangedEventArgs e )
106106 {
107- ( ( WindowedContentDialog ) d ) . _view . PrimaryButtonContent = e . NewValue ;
107+ ( ( WindowedContentDialog ) d ) . _view . PrimaryButtonContent = e . NewValue ;
108108 }
109109
110110 public DataTemplate ? PrimaryButtonTemplate
111111 {
112- get => ( DataTemplate ? ) GetValue ( PrimaryButtonTemplateProperty ) ;
112+ get => ( DataTemplate ? ) GetValue ( PrimaryButtonTemplateProperty ) ;
113113 set => SetValue ( PrimaryButtonTemplateProperty , value ) ;
114114 }
115115
@@ -122,7 +122,7 @@ public DataTemplate? PrimaryButtonTemplate
122122
123123 public object ? SecondaryButtonContent
124124 {
125- get => ( object ? ) GetValue ( SecondaryButtonContentProperty ) ;
125+ get => ( object ? ) GetValue ( SecondaryButtonContentProperty ) ;
126126 set => SetValue ( SecondaryButtonContentProperty , value ) ;
127127 }
128128
@@ -135,12 +135,12 @@ public object? SecondaryButtonContent
135135
136136 private static void OnSecondaryButtonContentChanged ( DependencyObject d , DependencyPropertyChangedEventArgs e )
137137 {
138- ( ( WindowedContentDialog ) d ) . _view . SecondaryButtonContent = e . NewValue ;
138+ ( ( WindowedContentDialog ) d ) . _view . SecondaryButtonContent = e . NewValue ;
139139 }
140140
141141 public DataTemplate ? SecondaryButtonTemplate
142142 {
143- get => ( DataTemplate ? ) GetValue ( SecondaryButtonTemplateProperty ) ;
143+ get => ( DataTemplate ? ) GetValue ( SecondaryButtonTemplateProperty ) ;
144144 set => SetValue ( SecondaryButtonTemplateProperty , value ) ;
145145 }
146146
@@ -153,12 +153,12 @@ public DataTemplate? SecondaryButtonTemplate
153153
154154 private static void OnSecondaryButtonTemplateChanged ( DependencyObject d , DependencyPropertyChangedEventArgs e )
155155 {
156- ( ( WindowedContentDialog ) d ) . _view . SecondaryButtonTemplate = ( DataTemplate ? ) e . NewValue ;
156+ ( ( WindowedContentDialog ) d ) . _view . SecondaryButtonTemplate = ( DataTemplate ? ) e . NewValue ;
157157 }
158158
159159 public object ? CloseButtonContent
160160 {
161- get => ( object ? ) GetValue ( CloseButtonContentProperty ) ;
161+ get => ( object ? ) GetValue ( CloseButtonContentProperty ) ;
162162 set => SetValue ( CloseButtonContentProperty , value ) ;
163163 }
164164
@@ -171,12 +171,12 @@ public object? CloseButtonContent
171171
172172 private static void OnCloseButtonContentChanged ( DependencyObject d , DependencyPropertyChangedEventArgs e )
173173 {
174- ( ( WindowedContentDialog ) d ) . _view . CloseButtonContent = e . NewValue ;
174+ ( ( WindowedContentDialog ) d ) . _view . CloseButtonContent = e . NewValue ;
175175 }
176176
177177 public DataTemplate ? CloseButtonTemplate
178178 {
179- get => ( DataTemplate ? ) GetValue ( CloseButtonTemplateProperty ) ;
179+ get => ( DataTemplate ? ) GetValue ( CloseButtonTemplateProperty ) ;
180180 set => SetValue ( CloseButtonTemplateProperty , value ) ;
181181 }
182182
@@ -189,12 +189,12 @@ public DataTemplate? CloseButtonTemplate
189189
190190 private static void OnCloseButtonTemplateChanged ( DependencyObject d , DependencyPropertyChangedEventArgs e )
191191 {
192- ( ( WindowedContentDialog ) d ) . _view . CloseButtonTemplate = ( DataTemplate ? ) e . NewValue ;
192+ ( ( WindowedContentDialog ) d ) . _view . CloseButtonTemplate = ( DataTemplate ? ) e . NewValue ;
193193 }
194194
195195 public ICommand ? PrimaryButtonCommand
196196 {
197- get => ( ICommand ? ) GetValue ( PrimaryButtonCommandProperty ) ;
197+ get => ( ICommand ? ) GetValue ( PrimaryButtonCommandProperty ) ;
198198 set => SetValue ( PrimaryButtonCommandProperty , value ) ;
199199 }
200200
@@ -207,12 +207,12 @@ public ICommand? PrimaryButtonCommand
207207
208208 private static void OnPrimaryButtonCommandChanged ( DependencyObject d , DependencyPropertyChangedEventArgs e )
209209 {
210- ( ( WindowedContentDialog ) d ) . _view . PrimaryButtonCommand = ( ICommand ? ) e . NewValue ;
210+ ( ( WindowedContentDialog ) d ) . _view . PrimaryButtonCommand = ( ICommand ? ) e . NewValue ;
211211 }
212212
213213 public ICommand ? SecondaryButtonCommand
214214 {
215- get => ( ICommand ? ) GetValue ( SecondaryButtonCommandProperty ) ;
215+ get => ( ICommand ? ) GetValue ( SecondaryButtonCommandProperty ) ;
216216 set => SetValue ( SecondaryButtonCommandProperty , value ) ;
217217 }
218218
@@ -225,12 +225,12 @@ public ICommand? SecondaryButtonCommand
225225
226226 private static void OnSecondaryButtonCommandChanged ( DependencyObject d , DependencyPropertyChangedEventArgs e )
227227 {
228- ( ( WindowedContentDialog ) d ) . _view . SecondaryButtonCommand = ( ICommand ? ) e . NewValue ;
228+ ( ( WindowedContentDialog ) d ) . _view . SecondaryButtonCommand = ( ICommand ? ) e . NewValue ;
229229 }
230230
231231 public ICommand ? CloseButtonCommand
232232 {
233- get => ( ICommand ? ) GetValue ( CloseButtonCommandProperty ) ;
233+ get => ( ICommand ? ) GetValue ( CloseButtonCommandProperty ) ;
234234 set => SetValue ( CloseButtonCommandProperty , value ) ;
235235 }
236236
@@ -243,12 +243,12 @@ public ICommand? CloseButtonCommand
243243
244244 private static void OnCloseButtonCommandChanged ( DependencyObject d , DependencyPropertyChangedEventArgs e )
245245 {
246- ( ( WindowedContentDialog ) d ) . _view . CloseButtonCommand = ( ICommand ? ) e . NewValue ;
246+ ( ( WindowedContentDialog ) d ) . _view . CloseButtonCommand = ( ICommand ? ) e . NewValue ;
247247 }
248248
249249 public bool IsPrimaryButtonEnabled
250250 {
251- get => ( bool ) GetValue ( IsPrimaryButtonEnabledProperty ) ;
251+ get => ( bool ) GetValue ( IsPrimaryButtonEnabledProperty ) ;
252252 set => SetValue ( IsPrimaryButtonEnabledProperty , value ) ;
253253 }
254254
@@ -261,12 +261,12 @@ public bool IsPrimaryButtonEnabled
261261
262262 private static void OnIsPrimaryButtonEnabledChanged ( DependencyObject d , DependencyPropertyChangedEventArgs e )
263263 {
264- ( ( WindowedContentDialog ) d ) . _view . IsPrimaryButtonEnabled = ( bool ) e . NewValue ;
264+ ( ( WindowedContentDialog ) d ) . _view . IsPrimaryButtonEnabled = ( bool ) e . NewValue ;
265265 }
266266
267267 public bool IsSecondaryButtonEnabled
268268 {
269- get => ( bool ) GetValue ( IsSecondaryButtonEnabledProperty ) ;
269+ get => ( bool ) GetValue ( IsSecondaryButtonEnabledProperty ) ;
270270 set => SetValue ( IsSecondaryButtonEnabledProperty , value ) ;
271271 }
272272
@@ -279,12 +279,12 @@ public bool IsSecondaryButtonEnabled
279279
280280 private static void OnIsSecondaryButtonEnabledChanged ( DependencyObject d , DependencyPropertyChangedEventArgs e )
281281 {
282- ( ( WindowedContentDialog ) d ) . _view . IsSecondaryButtonEnabled = ( bool ) e . NewValue ;
282+ ( ( WindowedContentDialog ) d ) . _view . IsSecondaryButtonEnabled = ( bool ) e . NewValue ;
283283 }
284284
285285 public Orientation ButtonOrientation
286286 {
287- get => ( Orientation ) GetValue ( ButtonOrientationProperty ) ;
287+ get => ( Orientation ) GetValue ( ButtonOrientationProperty ) ;
288288 set => SetValue ( ButtonOrientationProperty , value ) ;
289289 }
290290
@@ -297,12 +297,12 @@ public Orientation ButtonOrientation
297297
298298 private static void OnButtonOrientationChanged ( DependencyObject d , DependencyPropertyChangedEventArgs e )
299299 {
300- ( ( WindowedContentDialog ) d ) . _view . ButtonOrientation = ( Orientation ) e . NewValue ;
300+ ( ( WindowedContentDialog ) d ) . _view . ButtonOrientation = ( Orientation ) e . NewValue ;
301301 }
302302
303303 public Style ? PrimaryButtonStyle
304304 {
305- get => ( Style ? ) GetValue ( PrimaryButtonStyleProperty ) ;
305+ get => ( Style ? ) GetValue ( PrimaryButtonStyleProperty ) ;
306306 set => SetValue ( PrimaryButtonStyleProperty , value ) ;
307307 }
308308
@@ -315,12 +315,12 @@ public Style? PrimaryButtonStyle
315315
316316 private static void OnPrimaryButtonStyleChanged ( DependencyObject d , DependencyPropertyChangedEventArgs e )
317317 {
318- ( ( WindowedContentDialog ) d ) . _view . PrimaryButtonStyle = ( Style ? ) e . NewValue ;
318+ ( ( WindowedContentDialog ) d ) . _view . PrimaryButtonStyle = ( Style ? ) e . NewValue ;
319319 }
320320
321321 public Style ? SecondaryButtonStyle
322322 {
323- get => ( Style ? ) GetValue ( SecondaryButtonStyleProperty ) ;
323+ get => ( Style ? ) GetValue ( SecondaryButtonStyleProperty ) ;
324324 set => SetValue ( SecondaryButtonStyleProperty , value ) ;
325325 }
326326
@@ -333,12 +333,12 @@ public Style? SecondaryButtonStyle
333333
334334 private static void OnSecondaryButtonStyleChanged ( DependencyObject d , DependencyPropertyChangedEventArgs e )
335335 {
336- ( ( WindowedContentDialog ) d ) . _view . SecondaryButtonStyle = ( Style ? ) e . NewValue ;
336+ ( ( WindowedContentDialog ) d ) . _view . SecondaryButtonStyle = ( Style ? ) e . NewValue ;
337337 }
338338
339339 public Style ? CloseButtonStyle
340340 {
341- get => ( Style ? ) GetValue ( CloseButtonStyleProperty ) ;
341+ get => ( Style ? ) GetValue ( CloseButtonStyleProperty ) ;
342342 set => SetValue ( CloseButtonStyleProperty , value ) ;
343343 }
344344
@@ -351,12 +351,12 @@ public Style? CloseButtonStyle
351351
352352 private static void OnCloseButtonStyleChanged ( DependencyObject d , DependencyPropertyChangedEventArgs e )
353353 {
354- ( ( WindowedContentDialog ) d ) . _view . CloseButtonStyle = ( Style ? ) e . NewValue ;
354+ ( ( WindowedContentDialog ) d ) . _view . CloseButtonStyle = ( Style ? ) e . NewValue ;
355355 }
356356
357357 public string ? PrimaryButtonAccessKey
358358 {
359- get => ( string ? ) GetValue ( PrimaryButtonAccessKeyProperty ) ;
359+ get => ( string ? ) GetValue ( PrimaryButtonAccessKeyProperty ) ;
360360 set => SetValue ( PrimaryButtonAccessKeyProperty , value ) ;
361361 }
362362
@@ -369,12 +369,12 @@ public string? PrimaryButtonAccessKey
369369
370370 private static void OnPrimaryButtonAccessKeyChanged ( DependencyObject d , DependencyPropertyChangedEventArgs e )
371371 {
372- ( ( WindowedContentDialog ) d ) . _view . PrimaryButtonAccessKey = ( string ? ) e . NewValue ;
372+ ( ( WindowedContentDialog ) d ) . _view . PrimaryButtonAccessKey = ( string ? ) e . NewValue ;
373373 }
374374
375375 public string ? SecondaryButtonAccessKey
376376 {
377- get => ( string ? ) GetValue ( SecondaryButtonAccessKeyProperty ) ;
377+ get => ( string ? ) GetValue ( SecondaryButtonAccessKeyProperty ) ;
378378 set => SetValue ( SecondaryButtonAccessKeyProperty , value ) ;
379379 }
380380
@@ -387,12 +387,12 @@ public string? SecondaryButtonAccessKey
387387
388388 private static void OnSecondaryButtonAccessKeyChanged ( DependencyObject d , DependencyPropertyChangedEventArgs e )
389389 {
390- ( ( WindowedContentDialog ) d ) . _view . SecondaryButtonAccessKey = ( string ? ) e . NewValue ;
390+ ( ( WindowedContentDialog ) d ) . _view . SecondaryButtonAccessKey = ( string ? ) e . NewValue ;
391391 }
392392
393393 public string ? CloseButtonAccessKey
394394 {
395- get => ( string ? ) GetValue ( CloseButtonAccessKeyProperty ) ;
395+ get => ( string ? ) GetValue ( CloseButtonAccessKeyProperty ) ;
396396 set => SetValue ( CloseButtonAccessKeyProperty , value ) ;
397397 }
398398
@@ -405,12 +405,12 @@ public string? CloseButtonAccessKey
405405
406406 private static void OnCloseButtonAccessKeyChanged ( DependencyObject d , DependencyPropertyChangedEventArgs e )
407407 {
408- ( ( WindowedContentDialog ) d ) . _view . CloseButtonAccessKey = ( string ? ) e . NewValue ;
408+ ( ( WindowedContentDialog ) d ) . _view . CloseButtonAccessKey = ( string ? ) e . NewValue ;
409409 }
410410
411411 public ContentDialogButton DefaultButton
412412 {
413- get => ( ContentDialogButton ) GetValue ( DefaultButtonProperty ) ;
413+ get => ( ContentDialogButton ) GetValue ( DefaultButtonProperty ) ;
414414 set => SetValue ( DefaultButtonProperty , value ) ;
415415 }
416416
@@ -423,12 +423,12 @@ public ContentDialogButton DefaultButton
423423
424424 private static void OnDefaultButtonChanged ( DependencyObject d , DependencyPropertyChangedEventArgs e )
425425 {
426- ( ( WindowedContentDialog ) d ) . _view . DefaultButton = ( ContentDialogButton ) e . NewValue ;
426+ ( ( WindowedContentDialog ) d ) . _view . DefaultButton = ( ContentDialogButton ) e . NewValue ;
427427 }
428428
429429 public SystemBackdrop ? SystemBackdrop
430430 {
431- get => ( SystemBackdrop ? ) GetValue ( SystemBackdropProperty ) ;
431+ get => ( SystemBackdrop ? ) GetValue ( SystemBackdropProperty ) ;
432432 set => SetValue ( SystemBackdropProperty , value ) ;
433433 }
434434
@@ -453,9 +453,8 @@ public SystemBackdrop? SystemBackdrop
453453 public event EventHandler ? SecondaryButtonClick ;
454454 public event EventHandler ? CloseButtonClick ;
455455
456- public Task < ContentDialogResult > ShowAsync ( )
456+ public async Task < ContentDialogResult > ShowAsync ( )
457457 {
458- _taskCompletionSource = new TaskCompletionSource < ContentDialogResult > ( ) ;
459458 _window = new DialogWindowBase
460459 {
461460 Content = _view ,
@@ -474,9 +473,8 @@ public Task<ContentDialogResult> ShowAsync()
474473 {
475474 dragMoveHelper . SetDragMove ( _view ) ;
476475 }
477- _window . Closed += OnWindowClosed ;
478- _window . ShowDialog ( ) ;
479- return _taskCompletionSource . Task ;
476+ await _window . ShowDialogAsync ( ) ;
477+ return Result ;
480478 }
481479
482480 private void OnPrimaryButtonClick ( object ? sender , EventArgs e )
@@ -496,9 +494,5 @@ private void OnCloseButtonClick(object? sender, EventArgs e)
496494 _window ! . TryClose ( ) ;
497495 CloseButtonClick ? . Invoke ( this , EventArgs . Empty ) ;
498496 }
499-
500- private void OnWindowClosed ( object ? sender , EventArgs e )
501- {
502- _taskCompletionSource ? . SetResult ( Result ) ;
503- }
504497}
498+
0 commit comments