Skip to content

Commit

Permalink
Register compatibilty handlers for RelativeLayout and AbsoluteLayout (#…
Browse files Browse the repository at this point in the history
…3723) Fixes #3006 Fixes #2062

Fixes #3006; Fixes #2062;
  • Loading branch information
hartez authored Dec 11, 2021
1 parent 9970321 commit b143a77
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/Compatibility/Core/src/AppHostBuilderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ static MauiAppBuilder SetupDefaults(this MauiAppBuilder builder)
handlers.TryAddCompatibilityRenderer(typeof(ViewCell), typeof(ViewCellRenderer));
handlers.TryAddCompatibilityRenderer(typeof(SwitchCell), typeof(SwitchCellRenderer));


handlers.TryAddCompatibilityRenderer(typeof(Microsoft.Maui.Controls.Compatibility.RelativeLayout), typeof(DefaultRenderer));
handlers.TryAddCompatibilityRenderer(typeof(Microsoft.Maui.Controls.Compatibility.AbsoluteLayout), typeof(DefaultRenderer));

// This is for Layouts that currently don't work when assigned to LayoutHandler

DependencyService.Register<Xaml.ResourcesLoader>();
Expand Down
4 changes: 2 additions & 2 deletions src/Controls/src/Core/LegacyLayouts/AbsoluteLayout.cs
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ static Rectangle ComputeLayoutForRegion(View view, Size region)

if (xIsProportional)
{
result.X = DeviceDisplay.MainDisplayInfo.DisplayRound((region.Width - result.Width) * bounds.X);
result.X = Math.Round((region.Width - result.Width) * bounds.X);
}
else
{
Expand All @@ -282,7 +282,7 @@ static Rectangle ComputeLayoutForRegion(View view, Size region)

if (yIsProportional)
{
result.Y = DeviceDisplay.MainDisplayInfo.DisplayRound((region.Height - result.Height) * bounds.Y);
result.Y =Math.Round((region.Height - result.Height) * bounds.Y);
}
else
{
Expand Down

0 comments on commit b143a77

Please sign in to comment.