Home > Software engineering >  How do I clip the overflow of my Polyline
How do I clip the overflow of my Polyline

Time:11-03

So I have a border with a CornerRadius and I added a Polyline to it, hoping that it would clip where the CornerRadius is, but it doesn't. As you can see in the image it overflows and I want it to clip if it reaches where the CornerRadius starts.

<Border Width="320"
        Height="368"
        CornerRadius="10"
        Background="#1D1A27"
        Margin="50,0,0,0">
            
            <Polyline Points="0,0 320,0 0, 80"
                      Fill="AliceBlue" />
            
</Border>

enter image description here

CodePudding user response:

Set the Border's Clip to an appropriate RectangleGeometry:

<Border Width="320" Height="368" Background="#1D1A27" Margin="50,0,0,0">
    <Border.Clip>
        <RectangleGeometry RadiusX="10" RadiusY="10" Rect="0,0,320,368"/>
    </Border.Clip>

    <Polyline Points="0,0 320,0 0,80" Fill="AliceBlue" />
</Border>
  • Related