diff --git a/src/Controls/src/Core/ContentPage/ContentPage.cs b/src/Controls/src/Core/ContentPage/ContentPage.cs
index 32001e6a79b1..65d57dba752c 100644
--- a/src/Controls/src/Core/ContentPage/ContentPage.cs
+++ b/src/Controls/src/Core/ContentPage/ContentPage.cs
@@ -89,6 +89,7 @@ protected override void InvalidateMeasureOverride()
IView IReplaceableView.ReplacedView => HotReload.MauiHotReloadHelper.GetReplacedView(this) ?? this;
HotReload.IReloadHandler HotReload.IHotReloadableView.ReloadHandler { get; set; }
+ Thickness IPadding.Padding { get; }
void HotReload.IHotReloadableView.TransferState(IView newView)
{
@@ -108,10 +109,8 @@ void HotReload.IHotReloadableView.Reload()
//TODO: if reload handler is null, Do a manual reload?
});
}
- #endregion
-#if NETSTANDARD
- // NetStandard doesn't support default interface implementations, so we provide them here.
+ #endregion
Size IContentView.CrossPlatformArrange(Rect bounds)
{
@@ -122,6 +121,5 @@ Size IContentView.CrossPlatformMeasure(double widthConstraint, double heightCons
{
return (this as ICrossPlatformLayout).CrossPlatformMeasure(widthConstraint, heightConstraint);
}
-#endif
}
}
\ No newline at end of file
diff --git a/src/Core/src/Core/IContentView.cs b/src/Core/src/Core/IContentView.cs
index 380704c72e31..8d8ab1051d7e 100644
--- a/src/Core/src/Core/IContentView.cs
+++ b/src/Core/src/Core/IContentView.cs
@@ -17,34 +17,16 @@ public interface IContentView : IView, IPadding, ICrossPlatformLayout
///
IView? PresentedContent { get; }
-#if NETSTANDARD2_0
///
- /// This interface method is provided as a stub for .NET Standard
+ /// This interface method is provided for backward compatibility with previous versions.
+ /// Implementing classes should implement the ICrossPlatformLayout interface rather than directly implementing this method.
///
new Size CrossPlatformMeasure(double widthConstraint, double heightConstraint);
///
- /// This interface method is provided as a stub for .NET Standard
+ /// This interface method is provided for backward compatibility with previous versions.
+ /// Implementing classes should implement the ICrossPlatformLayout interface rather than directly implementing this method.
///
new Size CrossPlatformArrange(Rect bounds);
-#else
- ///
- /// This implementation is provided as a bridge for previous versions. Implementing classes should implement
- /// the ICrossPlatformLayout interface rather than directly implementing this method.
- ///
- new Size CrossPlatformMeasure(double widthConstraint, double heightConstraint)
- {
- return (this as ICrossPlatformLayout).CrossPlatformMeasure(widthConstraint, heightConstraint);
- }
-
- ///
- /// This implementation is provided as a bridge for previous versions. Implementing classes should implement
- /// the ICrossPlatformLayout interface rather than directly implementing this method.
- ///
- new Size CrossPlatformArrange(Rect bounds)
- {
- return (this as ICrossPlatformLayout).CrossPlatformArrange(bounds);
- }
-#endif
}
}
\ No newline at end of file
diff --git a/src/Core/src/Core/ICrossPlatformLayout.cs b/src/Core/src/Core/ICrossPlatformLayout.cs
index 135ee3ae17b2..a9efe477bd09 100644
--- a/src/Core/src/Core/ICrossPlatformLayout.cs
+++ b/src/Core/src/Core/ICrossPlatformLayout.cs
@@ -10,13 +10,37 @@ public interface ICrossPlatformLayout
/// The width limit for measuring the ICrossPlatformLayout.
/// The height limit for measuring the ICrossPlatformLayout.
/// The desired size of the ILayout.
+#if NETSTANDARD2_0
Size CrossPlatformMeasure(double widthConstraint, double heightConstraint);
+#else
+ Size CrossPlatformMeasure(double widthConstraint, double heightConstraint)
+ {
+ return this switch
+ {
+ IContentView contentView => contentView.CrossPlatformMeasure(widthConstraint, heightConstraint),
+ ILayout layout => layout.CrossPlatformMeasure(widthConstraint, heightConstraint),
+ _ => Size.Zero,
+ };
+ }
+#endif
///
/// Arranges the children of the ICrossPlatformLayout within the given bounds.
///
/// The bounds in which the ICrossPlatformLayout's children should be arranged.
/// The actual size of the arranged ICrossPlatformLayout.
+#if NETSTANDARD2_0
Size CrossPlatformArrange(Rect bounds);
+#else
+ Size CrossPlatformArrange(Rect bounds)
+ {
+ return this switch
+ {
+ IContentView contentView => contentView.CrossPlatformArrange(bounds),
+ ILayout layout => layout.CrossPlatformArrange(bounds),
+ _ => Size.Zero,
+ };
+ }
+#endif
}
}
diff --git a/src/Core/src/Core/ILayout.cs b/src/Core/src/Core/ILayout.cs
index 1bc99bed66c5..521690256616 100644
--- a/src/Core/src/Core/ILayout.cs
+++ b/src/Core/src/Core/ILayout.cs
@@ -13,34 +13,16 @@ public interface ILayout : IView, IContainer, ISafeAreaView, IPadding, ICrossPla
///
bool ClipsToBounds { get; }
-#if NETSTANDARD2_0
///
- /// This interface method is provided as a stub for .NET Standard
- ///
- new Size CrossPlatformMeasure(double widthConstraint, double heightConstraint);
-
- ///
- /// This interface method is provided as a stub for .NET Standard
+ /// This interface method is provided for backward compatibility with previous versions.
+ /// Implementing classes should implement the ICrossPlatformLayout interface rather than directly implementing this method.
///
new Size CrossPlatformArrange(Rect bounds);
-#else
- ///
- /// This implementation is provided as a bridge for previous versions. Implementing classes should implement
- /// the ICrossPlatformLayout interface rather than directly implementing this method.
- ///
- new Size CrossPlatformMeasure(double widthConstraint, double heightConstraint)
- {
- return (this as ICrossPlatformLayout).CrossPlatformMeasure(widthConstraint, heightConstraint);
- }
///
- /// This implementation is provided as a bridge for previous versions. Implementing classes should implement
- /// the ICrossPlatformLayout interface rather than directly implementing this method.
+ /// This interface method is provided for backward compatibility with previous versions.
+ /// Implementing classes should implement the ICrossPlatformLayout interface rather than directly implementing this method.
///
- new Size CrossPlatformArrange(Rect bounds)
- {
- return (this as ICrossPlatformLayout).CrossPlatformArrange(bounds);
- }
-#endif
+ new Size CrossPlatformMeasure(double widthConstraint, double heightConstraint);
}
}