diff --git a/native/Avalonia.Native/src/OSX/window.mm b/native/Avalonia.Native/src/OSX/window.mm
index 870345e543..6bd09fe08b 100644
--- a/native/Avalonia.Native/src/OSX/window.mm
+++ b/native/Avalonia.Native/src/OSX/window.mm
@@ -202,6 +202,21 @@ public:
}
}
+ virtual HRESULT GetTotalSize(AvnSize* ret) override
+ {
+ @autoreleasepool
+ {
+ if(ret == nullptr)
+ return E_POINTER;
+
+ auto frame = [Window frame];
+ ret->Width = frame.size.width;
+ ret->Height = frame.size.height;
+
+ return S_OK;
+ }
+ }
+
virtual HRESULT GetScaling (double* ret) override
{
@autoreleasepool
diff --git a/src/Android/Avalonia.Android/Platform/SkiaPlatform/TopLevelImpl.cs b/src/Android/Avalonia.Android/Platform/SkiaPlatform/TopLevelImpl.cs
index 60b772a183..8b732a92da 100644
--- a/src/Android/Avalonia.Android/Platform/SkiaPlatform/TopLevelImpl.cs
+++ b/src/Android/Avalonia.Android/Platform/SkiaPlatform/TopLevelImpl.cs
@@ -55,6 +55,8 @@ namespace Avalonia.Android.Platform.SkiaPlatform
public virtual Size ClientSize => Size.ToSize(RenderScaling);
+ public Size TotalSize => ClientSize;
+
public IMouseDevice MouseDevice { get; } = new MouseDevice();
public Action Closed { get; set; }
diff --git a/src/Avalonia.Controls/ApiCompatBaseline.txt b/src/Avalonia.Controls/ApiCompatBaseline.txt
index a79b3b4d7b..166a005e4d 100644
--- a/src/Avalonia.Controls/ApiCompatBaseline.txt
+++ b/src/Avalonia.Controls/ApiCompatBaseline.txt
@@ -11,4 +11,6 @@ EnumValuesMustMatch : Enum value 'Avalonia.Platform.ExtendClientAreaChromeHints
InterfacesShouldHaveSameMembers : Interface member 'public void Avalonia.Platform.ITopLevelImpl.SetCursor(Avalonia.Platform.ICursorImpl)' is present in the implementation but not in the contract.
InterfacesShouldHaveSameMembers : Interface member 'public void Avalonia.Platform.ITopLevelImpl.SetCursor(Avalonia.Platform.IPlatformHandle)' is present in the contract but not in the implementation.
MembersMustExist : Member 'public void Avalonia.Platform.ITopLevelImpl.SetCursor(Avalonia.Platform.IPlatformHandle)' does not exist in the implementation but it does exist in the contract.
-Total Issues: 12
+InterfacesShouldHaveSameMembers : Interface member 'public Avalonia.Size Avalonia.Platform.ITopLevelImpl.TotalSize' is present in the implementation but not in the contract.
+InterfacesShouldHaveSameMembers : Interface member 'public Avalonia.Size Avalonia.Platform.ITopLevelImpl.TotalSize.get()' is present in the implementation but not in the contract.
+Total Issues: 14
diff --git a/src/Avalonia.Controls/Embedding/Offscreen/OffscreenTopLevelImpl.cs b/src/Avalonia.Controls/Embedding/Offscreen/OffscreenTopLevelImpl.cs
index ca0e9d48b8..cb0c5d94e5 100644
--- a/src/Avalonia.Controls/Embedding/Offscreen/OffscreenTopLevelImpl.cs
+++ b/src/Avalonia.Controls/Embedding/Offscreen/OffscreenTopLevelImpl.cs
@@ -35,6 +35,16 @@ namespace Avalonia.Controls.Embedding.Offscreen
}
}
+ public Size TotalSize
+ {
+ get { return _clientSize; }
+ set
+ {
+ _clientSize = value;
+ Resized?.Invoke(value);
+ }
+ }
+
public double RenderScaling
{
get { return _scaling; }
diff --git a/src/Avalonia.Controls/Platform/ITopLevelImpl.cs b/src/Avalonia.Controls/Platform/ITopLevelImpl.cs
index 09f38042a1..546184f8a6 100644
--- a/src/Avalonia.Controls/Platform/ITopLevelImpl.cs
+++ b/src/Avalonia.Controls/Platform/ITopLevelImpl.cs
@@ -22,6 +22,11 @@ namespace Avalonia.Platform
///
Size ClientSize { get; }
+ ///
+ /// Gets the total size of the toplevel, excluding shadows.
+ ///
+ Size TotalSize { get; }
+
///
/// Gets the scaling factor for the toplevel. This is used for rendering.
///
diff --git a/src/Avalonia.Controls/TopLevel.cs b/src/Avalonia.Controls/TopLevel.cs
index 7a92836ddf..e2d9e7e697 100644
--- a/src/Avalonia.Controls/TopLevel.cs
+++ b/src/Avalonia.Controls/TopLevel.cs
@@ -42,6 +42,12 @@ namespace Avalonia.Controls
public static readonly DirectProperty ClientSizeProperty =
AvaloniaProperty.RegisterDirect(nameof(ClientSize), o => o.ClientSize);
+ ///
+ /// Defines the property.
+ ///
+ public static readonly DirectProperty TotalSizeProperty =
+ AvaloniaProperty.RegisterDirect(nameof(TotalSize), o => o.TotalSize);
+
///
/// Defines the property.
///
@@ -74,6 +80,7 @@ namespace Avalonia.Controls
private readonly IPlatformRenderInterface _renderInterface;
private readonly IGlobalStyles _globalStyles;
private Size _clientSize;
+ private Size _totalSize;
private WindowTransparencyLevel _actualTransparencyLevel;
private ILayoutManager _layoutManager;
private Border _transparencyFallbackBorder;
@@ -84,6 +91,7 @@ namespace Avalonia.Controls
static TopLevel()
{
AffectsMeasure(ClientSizeProperty);
+ AffectsMeasure(TotalSizeProperty);
TransparencyLevelHintProperty.Changed.AddClassHandler(
(tl, e) =>
@@ -194,9 +202,18 @@ namespace Avalonia.Controls
public Size ClientSize
{
get { return _clientSize; }
- protected set { SetAndRaise(ClientSizeProperty, ref _clientSize, value); }
+ protected set
+ {
+ SetAndRaise(ClientSizeProperty, ref _clientSize, value);
+ SetAndRaise(TotalSizeProperty, ref _totalSize, PlatformImpl.TotalSize);
+ }
}
+ ///
+ /// Gets or sets the total size of the window.
+ ///
+ public Size TotalSize => _totalSize;
+
///
/// Gets or sets the that the TopLevel should use when possible.
///
diff --git a/src/Avalonia.DesignerSupport/Remote/Stubs.cs b/src/Avalonia.DesignerSupport/Remote/Stubs.cs
index eedfc52d9d..91bc93d897 100644
--- a/src/Avalonia.DesignerSupport/Remote/Stubs.cs
+++ b/src/Avalonia.DesignerSupport/Remote/Stubs.cs
@@ -21,6 +21,7 @@ namespace Avalonia.DesignerSupport.Remote
public IPlatformHandle Handle { get; }
public Size MaxAutoSizeHint { get; }
public Size ClientSize { get; }
+ public Size TotalSize => ClientSize;
public double RenderScaling { get; } = 1.0;
public double DesktopScaling => 1.0;
public IEnumerable