I am writing a small application on WPF. It is necessary that inside the border (Border) there is a figure (for example, a Rectangle) to which certain transformations can be applied (for example, a turn by 30 degrees).
Everything turned out, but only when turning the figure, it goes beyond the bounds of the frame. How to fix it?
partial class AbstractShape : Border { public AbstractShape(in Shape shape) { InitializeComponent(); Child = shape; } } What is the problem, as it seems to me: The default shape of the figure is the Fill property, that is, it fills the entire accessible area, but instead of distorting itself, it prefers to get out of the box.
If I stretch the frame itself in height and width after the shape is rotated, the shape will also change its size accordingly and pop up again.


ClipToBoundstoTruewith yourBorder'a, then everything that goes beyond this element will be cut off . - EvgeniyZRenderTransformandLayoutTransform. Choose the one that suits you - Andrew NOP