Xamarin.Forms
Xamarin.Forms copied to clipboard
[Bug] iOS: Dashed Frame stopped working in the latest XF version
Description
Currently we have a Dashed Frame in our app and it was working flawlessly on Xamarin.Forms 4.6.0.800, however after upgrading to Xamarin.Forms 4.6.0.1141 it stopped working. The same issue happens in the latest Xamarin.Forms 4.7.*.
Steps to Reproduce
Here is the code for the iOS renderer:
<Frame Padding="20" BackgroundColor="LightBlue" BorderColor="Blue">
<Label>
</Label>
</Frame>
public class DashedBorderedFrameRenderer : FrameRenderer
{
private readonly CAShapeLayer dashedBorderFrame = new CAShapeLayer();
protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
{
base.OnElementPropertyChanged(sender, e);
if (Layer == null) return;
if (e.PropertyName.Equals(nameof(Element.BorderColor)))
{
UpdateBorderFrame();
}
}
private void UpdateBorderFrame()
{
dashedBorderFrame.StrokeColor = Element.BorderColor.ToCGColor();
Layer.BorderColor = Color.Transparent.ToCGColor();
Layer.BackgroundColor = Color.Transparent.ToCGColor();
}
public override void LayoutSubviews()
{
base.LayoutSubviews();
AddDashedBorderFrame();
}
private void AddDashedBorderFrame()
{
dashedBorderFrame.StrokeColor = Element.BorderColor.ToCGColor();
dashedBorderFrame.FillColor = null;
dashedBorderFrame.LineDashPattern = new NSNumber[] { new NSNumber(6), new NSNumber(6) };
dashedBorderFrame.Frame = NativeView.Bounds;
dashedBorderFrame.Path = UIBezierPath.FromRect(NativeView.Bounds).CGPath;
Layer.AddSublayer(dashedBorderFrame);
Layer.BorderColor = Color.Transparent.ToCGColor();
Layer.BackgroundColor = Color.Transparent.ToCGColor();
Element.HasShadow = false;
}
}
Expected Behavior

Actual Behavior

Basic Information
- Version with issue: 4.6.0.1141
- Last known good version: 4.6.0.800
- IDE: VS for Mac
- Platform Target Frameworks:
- iOS: 13.5
- Nuget Packages: Xamarin.Forms (latest versions)
- Affected Devices: iOS
Screenshots
Reproduction Link
Workaround
@felipemomm Please try 4.6.0.1180 and let us know if that resolves the issue. Thanks!
@samhouts Unfortunately the issue is still happening on 4.6.0.1180 and in the latest 4.7.0.1179 as well.
@samhouts Can you re-open this issue?