diff --git a/src/Uno.UI.Toolkit/ElevatedView.cs b/src/Uno.UI.Toolkit/ElevatedView.cs
index 1e87a90b9fb8..dc718d639e4a 100644
--- a/src/Uno.UI.Toolkit/ElevatedView.cs
+++ b/src/Uno.UI.Toolkit/ElevatedView.cs
@@ -73,6 +73,13 @@ protected override void OnApplyTemplate()
_border = GetTemplateChild("PART_Border") as Border;
_shadowHost = GetTemplateChild("PART_ShadowHost") as Panel;
+#if __IOS__ || __MACOS__
+ if (_border != null)
+ {
+ _border.BoundsPathUpdated += (s, e) => UpdateElevation();
+ }
+#endif
+
UpdateElevation();
}
@@ -109,7 +116,15 @@ public object ElevatedContent
#if !NETFX_CORE
public new static DependencyProperty BackgroundProperty { get ; } = DependencyProperty.Register(
- "Background", typeof(Brush), typeof(ElevatedView), new FrameworkPropertyMetadata(default(Brush), OnChanged));
+ "Background",
+ typeof(Brush),
+ typeof(ElevatedView),
+#if __IOS__ || __MACOS__
+ new FrameworkPropertyMetadata(default(Brush))
+#else
+ new FrameworkPropertyMetadata(default(Brush), OnChanged)
+#endif
+ );
public new Brush Background
{
@@ -118,7 +133,15 @@ public object ElevatedContent
}
public static DependencyProperty CornerRadiusProperty { get ; } = DependencyProperty.Register(
- "CornerRadius", typeof(CornerRadius), typeof(ElevatedView), new FrameworkPropertyMetadata(default(CornerRadius), OnChanged));
+ "CornerRadius",
+ typeof(CornerRadius),
+ typeof(ElevatedView),
+#if __IOS__ || __MACOS__
+ new FrameworkPropertyMetadata(default(CornerRadius))
+#else
+ new FrameworkPropertyMetadata(default(CornerRadius), OnChanged)
+#endif
+ );
public CornerRadius CornerRadius
{
diff --git a/src/Uno.UI/UI/Xaml/Controls/Border/Border.iOSmacOS.cs b/src/Uno.UI/UI/Xaml/Controls/Border/Border.iOSmacOS.cs
index cca067359bae..b6c88e9ec241 100644
--- a/src/Uno.UI/UI/Xaml/Controls/Border/Border.iOSmacOS.cs
+++ b/src/Uno.UI/UI/Xaml/Controls/Border/Border.iOSmacOS.cs
@@ -46,14 +46,12 @@ private void UpdateBorderLayer(_Image backgroundImage = null)
(Background as ImageBrush)?.ImageSource?.TryOpenSync(out backgroundImage);
}
- BoundsPath = _borderRenderer.UpdateLayer(
- this,
- Background,
- BorderThickness,
- BorderBrush,
- CornerRadius,
- backgroundImage
- );
+ if (_borderRenderer.UpdateLayer(this, Background, BorderThickness, BorderBrush, CornerRadius, backgroundImage)
+ is CGPath updated) // UpdateLayer may return null if there is no update
+ {
+ BoundsPath = updated;
+ BoundsPathUpdated?.Invoke(this, default);
+ }
}
this.SetNeedsDisplay();
@@ -114,6 +112,7 @@ partial void OnCornerRadiusUpdatedPartial(CornerRadius oldValue, CornerRadius ne
bool ICustomClippingElement.AllowClippingToLayoutSlot => CornerRadius == CornerRadius.None && (!(Child is UIElement ue) || ue.RenderTransform == null);
bool ICustomClippingElement.ForceClippingToLayoutSlot => false;
+ internal event EventHandler BoundsPathUpdated;
internal CGPath BoundsPath { get; private set; }
}
}
diff --git a/src/Uno.UI/UI/Xaml/Controls/Border/BorderLayerRenderer.iOSmacOS.cs b/src/Uno.UI/UI/Xaml/Controls/Border/BorderLayerRenderer.iOSmacOS.cs
index c852da20ff41..472182f881a4 100644
--- a/src/Uno.UI/UI/Xaml/Controls/Border/BorderLayerRenderer.iOSmacOS.cs
+++ b/src/Uno.UI/UI/Xaml/Controls/Border/BorderLayerRenderer.iOSmacOS.cs
@@ -40,13 +40,14 @@ internal class BorderLayerRenderer
/// The border brush
/// The corner radius
/// The background image in case of a ImageBrush background
+ /// An updated BoundsPath if the layer has been created or updated; null if there is no change.
public CGPath UpdateLayer(
_View owner,
Brush background,
Thickness borderThickness,
Brush borderBrush,
CornerRadius cornerRadius,
- _Image backgroundImage)
+ _Image backgroundImage)
{
// Bounds is captured to avoid calling twice calls below.
var bounds = owner.Bounds;