diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue12061.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue12061.cs
new file mode 100644
index 00000000000..aeacee0fd31
--- /dev/null
+++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue12061.cs
@@ -0,0 +1,63 @@
+using Xamarin.Forms.Internals;
+using Xamarin.Forms.CustomAttributes;
+
+#if UITEST
+using Xamarin.UITest;
+using NUnit.Framework;
+using Xamarin.Forms.Core.UITests;
+#endif
+
+namespace Xamarin.Forms.Controls.Issues
+{
+#if UITEST
+ [Category(UITestCategories.BoxView)]
+#endif
+ [Preserve(AllMembers = true)]
+ [Issue(IssueTracker.Github, 12061,
+ "[Bug] [Android] BoxView color is cleared when updating corner radius",
+ PlatformAffected.Android)]
+ public class Issue12061 : TestContentPage
+ {
+ public Issue12061()
+ {
+ }
+
+ protected override void Init()
+ {
+ Title = "Issue 12061";
+
+ var layout = new StackLayout();
+
+ var instructions = new Label
+ {
+ Padding = 12,
+ BackgroundColor = Color.Black,
+ TextColor = Color.White,
+ Text = "Tap the Button. The BoxView must be updated with ConerRadius but without losing the Color. If the BoxView Color is kept, the test has passed."
+ };
+
+ var boxView = new BoxView
+ {
+ CornerRadius = 0,
+ Color = Color.Red,
+ HeightRequest = 60
+ };
+
+ var button = new Button
+ {
+ Text = "Update CornerRadius"
+ };
+
+ layout.Children.Add(instructions);
+ layout.Children.Add(boxView);
+ layout.Children.Add(button);
+
+ Content = layout;
+
+ button.Clicked += (sender, args) =>
+ {
+ boxView.CornerRadius = 12;
+ };
+ }
+ }
+}
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems
index 4ae926b1a7b..b2010fbf668 100644
--- a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems
+++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems
@@ -1732,6 +1732,7 @@
+
diff --git a/Xamarin.Forms.Platform.Android/Renderers/BoxRenderer.cs b/Xamarin.Forms.Platform.Android/Renderers/BoxRenderer.cs
index 3ebd8ef4829..0195fcde24f 100644
--- a/Xamarin.Forms.Platform.Android/Renderers/BoxRenderer.cs
+++ b/Xamarin.Forms.Platform.Android/Renderers/BoxRenderer.cs
@@ -52,10 +52,8 @@ protected override void OnElementPropertyChanged(object sender, PropertyChangedE
base.OnElementPropertyChanged(sender, e);
- if (e.IsOneOf(VisualElement.BackgroundColorProperty, VisualElement.BackgroundProperty, BoxView.ColorProperty))
+ if (e.IsOneOf(VisualElement.BackgroundColorProperty, VisualElement.BackgroundProperty, BoxView.ColorProperty, BoxView.CornerRadiusProperty))
UpdateBoxView();
- else if (e.PropertyName == BoxView.CornerRadiusProperty.PropertyName)
- UpdateCornerRadius();
}
protected override void UpdateBackgroundColor()
@@ -179,8 +177,6 @@ void UpdateCornerRadius()
backgroundGradient.SetCornerRadii(cornerRadii);
}
}
-
- UpdateBackgroundColor();
}
}
}
\ No newline at end of file