Forum Xamarin.Mac

Announcement:

The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

CALayer.MasksToBounds not always working in Xamarin.Forms custom Frame renderer

JohnHJohnH GBMember ✭✭✭✭✭

Hi all, I have had to create a custom renderer for our Xamarin.Forms Mac project to implement the XF Layer.IsClippedToBounds property which hasn't been implemented yet in XF for Mac. I am doing that by using the native Layer.MasksToBounds property, but it doesn't clip on the first display, only on the second. Is there anything more I need to do?

Thanks
John

Best Answer

  • JohnHJohnH GBMember ✭✭✭✭✭
    Accepted Answer

    I figured it out, I could see that the VisualElementTracker was setting Layer.MasksToBounds to false! Thankfully the VisualElementRenderer has a virtual method called UpdateNativeWidget, which is where I can set the value accordingly.

Answers

  • JohnHJohnH GBMember ✭✭✭✭✭
    Accepted Answer

    I figured it out, I could see that the VisualElementTracker was setting Layer.MasksToBounds to false! Thankfully the VisualElementRenderer has a virtual method called UpdateNativeWidget, which is where I can set the value accordingly.

Sign In or Register to comment.