From 4e642b3e8cfd8dbde390494c5f2da30e46212920 Mon Sep 17 00:00:00 2001 From: robloo Date: Sun, 18 Jun 2023 10:59:38 -0400 Subject: [PATCH] Add OnSizeChanged method to Control --- src/Avalonia.Controls/Control.cs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/Avalonia.Controls/Control.cs b/src/Avalonia.Controls/Control.cs index ae7d4f3fb4..885b3f302e 100644 --- a/src/Avalonia.Controls/Control.cs +++ b/src/Avalonia.Controls/Control.cs @@ -357,6 +357,15 @@ namespace Avalonia.Controls RaiseEvent(eventArgs); } + /// + /// Invoked just before the event. + /// + /// The event args. + protected virtual void OnSizeChanged(SizeChangedEventArgs e) + { + RaiseEvent(e); + } + /// protected sealed override void OnAttachedToVisualTreeCore(VisualTreeAttachmentEventArgs e) { @@ -435,6 +444,10 @@ namespace Avalonia.Controls } } + /// + /// Returns a new, type-specific implementation for the control. + /// + /// The type-specific implementation. protected virtual AutomationPeer OnCreateAutomationPeer() { return new NoneAutomationPeer(this); @@ -459,6 +472,7 @@ namespace Avalonia.Controls return _automationPeer; } + /// protected override void OnPointerReleased(PointerReleasedEventArgs e) { base.OnPointerReleased(e); @@ -473,6 +487,7 @@ namespace Avalonia.Controls } } + /// protected override void OnKeyUp(KeyEventArgs e) { base.OnKeyUp(e); @@ -531,7 +546,7 @@ namespace Avalonia.Controls previousSize: new Size(oldValue.Width, oldValue.Height), newSize: new Size(newValue.Width, newValue.Height)); - RaiseEvent(sizeChangedEventArgs); + OnSizeChanged(sizeChangedEventArgs); } } }