Xamarin.forms: iOS Frame IsClippedToBounds broken [Bug]

Created on 17 Jun 2020  路  5Comments  路  Source: xamarin/Xamarin.Forms

Description

After upgrading from Forms from 4.6.0.726 to 4.6.0.967
frames on iOS stopped clipping content, tested with a grid inside.

Edit: Last good version checked 4.6.0.847 is okay.

Steps to Reproduce

<frame    CornerRadius="something"     IsClippedToBounds="True">
    <grid>
    <image/><or whatever/>
    </grid>
<frame>

Please kindly check here:
https://forums.xamarin.com/discussion/comment/414472

Expected Behavior

frame to clip content while IsClippedToBounds="True"

Actual Behavior

Not clipping content while IsClippedToBounds="True"

Basic Information

  • Version with issue: Forms 4.6.0.967
  • Last known good version: 4.6.0.847
  • IDE: VS 2019 16.6.2
  • Platform Target Frameworks:

    • iOS: latest.. no idea where to check the version when developing from windows

Screenshots

image

Reproduction Link

https://forums.xamarin.com/discussion/comment/414472 confirmed by xamarin staff, LeonLu.

Workaround

credits to LeonLu

```
[assembly: ExportRenderer(typeof(Frame), typeof(FrameFix))]
namespace Your.iOS.Renderers
{
protected override void OnElementChanged(ElementChangedEventArgs e)
{
base.OnElementChanged(e);

        if (e.OldElement != null && Control != null)
        {
            Control.PropertyChanged -= OnControlPropertyChanged;
        }

        if (e.NewElement!=null && NativeView != null)
        {
            Control = e.NewElement;
            Control.PropertyChanged += OnControlPropertyChanged;

            UpdateCorners();
        }
    }

    protected void UpdateCorners()
    {
        NativeView.Layer.AllowsEdgeAntialiasing = true;
        NativeView.Layer.MasksToBounds = Control.IsClippedToBounds;
        NativeView.Layer.CornerRadius = Control.CornerRadius;
    }

    private void OnControlPropertyChanged(object sender, PropertyChangedEventArgs e)
    {
        if (NativeView == null || Control == null)
            return;

        if (e.PropertyName == "IsClippedToBounds" 
            || e.PropertyName == "CornerRadius")
        {
            UpdateCorners();
        }
    }
}

```

4.6.0 frame high regression in-progress iOS 馃崕 bug

Most helpful comment

I've just upgraded to 4.7.1080 and this behaviour is still happening; the release notes mentioned there was a fix for #11031

All 5 comments

Already solved in nightly build version Xamarin.Forms nighly build 4.8.0.908

Just adding that UWP also works, it is really only iOS.

Is this one going to be fixed on 4.6.0?

I've just upgraded to 4.7.1080 and this behaviour is still happening; the release notes mentioned there was a fix for #11031

closed by #11129

Was this page helpful?
0 / 5 - 0 ratings