Browse Source
Merge pull request #11124 from AvaloniaUI/add-scaling-properties
Adds RenderScaling and DesktopScaling back to the public API together with ScalingChanged
pull/11131/head
Steven Kirk
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
12 additions and
1 deletions
-
src/Avalonia.Controls/TopLevel.cs
-
src/Avalonia.Controls/WindowBase.cs
|
|
|
@ -285,6 +285,11 @@ namespace Avalonia.Controls |
|
|
|
/// </summary>
|
|
|
|
public event EventHandler? Closed; |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Gets or sets a method called when the TopLevel's scaling changes.
|
|
|
|
/// </summary>
|
|
|
|
public event EventHandler? ScalingChanged; |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Gets or sets the client size of the window.
|
|
|
|
/// </summary>
|
|
|
|
@ -428,7 +433,7 @@ namespace Avalonia.Controls |
|
|
|
double ILayoutRoot.LayoutScaling => PlatformImpl?.RenderScaling ?? 1; |
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
double IRenderRoot.RenderScaling => PlatformImpl?.RenderScaling ?? 1; |
|
|
|
public double RenderScaling => PlatformImpl?.RenderScaling ?? 1; |
|
|
|
|
|
|
|
IStyleHost IStyleHost.StylingParent => _globalStyles!; |
|
|
|
|
|
|
|
@ -590,6 +595,7 @@ namespace Avalonia.Controls |
|
|
|
protected virtual void HandleScalingChanged(double scaling) |
|
|
|
{ |
|
|
|
LayoutHelper.InvalidateSelfAndChildrenMeasure(this); |
|
|
|
ScalingChanged?.Invoke(this, EventArgs.Empty); |
|
|
|
} |
|
|
|
|
|
|
|
private static bool TransparencyLevelsMatch (WindowTransparencyLevel requested, WindowTransparencyLevel received) |
|
|
|
|
|
|
|
@ -116,6 +116,11 @@ namespace Avalonia.Controls |
|
|
|
set { SetValue(TopmostProperty, value); } |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Gets the scaling factor for Window positioning and sizing.
|
|
|
|
/// </summary>
|
|
|
|
public double DesktopScaling => PlatformImpl?.DesktopScaling ?? 1; |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Activates the window.
|
|
|
|
/// </summary>
|
|
|
|
|