Browse Source
Merge pull request #2542 from AvaloniaUI/fixes/2458-window-onclosing
Added Window.OnClosing.
pull/2546/head
Steven Kirk
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
12 additions and
2 deletions
-
src/Avalonia.Controls/Window.cs
|
|
|
@ -330,8 +330,7 @@ namespace Avalonia.Controls |
|
|
|
protected virtual bool HandleClosing() |
|
|
|
{ |
|
|
|
var args = new CancelEventArgs(); |
|
|
|
Closing?.Invoke(this, args); |
|
|
|
|
|
|
|
OnClosing(args); |
|
|
|
return args.Cancel; |
|
|
|
} |
|
|
|
|
|
|
|
@ -576,6 +575,17 @@ namespace Avalonia.Controls |
|
|
|
|
|
|
|
base.HandleResized(clientSize); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Raises the <see cref="Closing"/> event.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="e">The event args.</param>
|
|
|
|
/// <remarks>
|
|
|
|
/// A type that derives from <see cref="Window"/> may override <see cref="OnClosing"/>. The
|
|
|
|
/// overridden method must call <see cref="OnClosing"/> on the base class if the
|
|
|
|
/// <see cref="Closing"/> event needs to be raised.
|
|
|
|
/// </remarks>
|
|
|
|
protected virtual void OnClosing(CancelEventArgs e) => Closing?.Invoke(this, e); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|