julien-100000 julien-100000 - 2 months ago 30
Vb.net Question

How to cut off overlapping areas?

My problem is that I want to create my own custom Control. In this control there is only a rectangle. This rectangle can be rotated. When i e.g. rotate the rectangle for 45 degrees then the rectangle overlaps. But i want that the overlappinmg areas are cut off.

This is what it looks like now:

This is what i want it to look like:

enter image description here

Is there any way to do this with WPF?


You have to, either programmatically or via XAML, set the control's ClipToBounds property to True.

Via code in the constructor:

Public Sub New() 'VB.NET
    Me.ClipToBounds = True
End Sub
public yourControl() { //C#
    this.ClipToBounds = true;


<yourControl ClipToBounds="True" />