DEV Community

Cover image for Clipping with Shapes in Xamarin.Forms
David Ortinau for .NET

Posted on

1 1

Clipping with Shapes in Xamarin.Forms

Shapes in Xamarin.Forms can now be applied to clip (or mask) and view. In this example I use an Ellipse to turn a square image into a circle image.

<Image Grid.Column="3" VerticalOptions="Center" Source="https://devblogs.microsoft.com/xamarin/wp-content/uploads/sites/44/2019/03/Screen-Shot-2017-01-03-at-3.35.53-PM.png">
<Image.Clip>
<EllipseGeometry RadiusX="22" RadiusY="22" Center="22,22" />
</Image.Clip>
</Image>

Resources:

GitHub logo davidortinau / PersonalFinanceSample

exploring Shapes and Gradients with Xamarin.Forms 4.8 pre-release




Top comments (1)

Collapse
 
jtkarrde profile image
Дима Никифоров

Why doesn't this work for android? Workaround - just use wrapper with CornerRadius

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay