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
parent
commit
b777bfa187
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      src/Avalonia.Controls/Window.cs

14
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);
}
}

Loading…
Cancel
Save