How to mask a square image into an image with round corners?
How do I want to implement a Rounded Cornered Mask for my image control . I created a control like this
<Border x:Name="Border1" CornerRadius="{Binding CornerRadius,Mode=TwoWay}" >
<Image x:Name="ImageSource1" Background="Transparent" >
</Image>
</Border>
<Border x:Name="MaskBorder1" BorderBrush="White" CornerRadius="{Binding CornerRadius,Mode=TwoWay}" BorderThickness="3" />
But I get Control with.
Anyone have an idea to fill the corners with Border color ?
source to share
Just pin the image, here is the snippet I'm using
<Image
Width="96"
Height="96"
Stretch="UniformToFill"
HorizontalAlignment="Left"
VerticalAlignment="Top">
<Image.Clip>
<EllipseGeometry
Center="48,48"
RadiusX="48"
RadiusY="48" />
</Image.Clip>
</Image>
For it to work, you need to set Center, RadiusX and RadiusY to half the image size.
source to share
I donβt know if this could help? But for image manipulation, I always find the Writeablebitmapex library ! And a good example of masking images can be found here ...
Hope it helps
source to share
Not sure what you are using CornerRadius="{Binding CornerRadius,Mode=TwoWay}"
, but I would be interested to see your implementation, after checking the Stecya post here , if this turns out to be what you are looking for.