Clipping of child elements

On the forums I saw this interesting problem where there was a need to round the corners of a stackpanel inside a border with cornerradius set...

The top is what you get and the bottom image is what you want. The simplest thing to do here is to set the padding on the border so that the stackpanel doesnt bleed around the corners.

But when that doesnt meet your requirements you will need to set the clip property on the child in the OnRender function so that you get the correct clipping. The code for the above is attached.(thanks to Ifeanyi)


Share this post