I try to create a border with a negative Corner radius, like this:
I want the radius on the inside. Is this possible with build in functions or do I have to paint it with a path?
You can define a <Border/> element and set its <Border. Background/> property to an <ImageBrush/> , set the Borders CornerRadius property and you are all set!
The border-radius CSS property rounds the corners of an element's outer border edge. You can set a single radius to make circular corners, or two radii to make elliptical corners.
Select the view that you want to round and open its Identity Inspector. In the User Defined Runtime Attributes section, add the following two entries: Key Path: layer. cornerRadius , Type: Number, Value: (whatever radius you want)
Well I faced the same problem and tried to figure out a solution.
Last but not least I came to the conclusion that it is not possible to solve this with a border
.
I focussed on drawing my Border
with the Path
and the CombinedGeometry
function.
If anyone is still looking for a solution how to make inverted round corners here is my solution:
<Grid>
<Path Stroke="Black" Fill="White" StrokeThickness="10" Stretch="Fill">
<Path.Data>
<CombinedGeometry GeometryCombineMode="Exclude">
<CombinedGeometry.Geometry1>
<RectangleGeometry Rect="100,200 200,100"/>
</CombinedGeometry.Geometry1>
<CombinedGeometry.Geometry2>
<EllipseGeometry RadiusX="50" RadiusY="50" Center="300,300" />
</CombinedGeometry.Geometry2>
</CombinedGeometry>
</Path.Data>
</Path>
<Button Margin="10" Height="10" Width="10"/>
</Grid>
You can resize the Rectangle
with changing the values in RectangleGeometry Rect="100,200 200,100
and add inside it any other WPF item.. in this case I added a Button
.
Here's the result:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With