You must use the Clip property.
Next, a button will be shown that will be displayed outside the canvas, since the button width> canvas width:
<Canvas Width="200" Height="200"> <Button>My button with a lot of text</Button> </Canvas>
Now, if I add the Clip property, I hide something that goes beyond the clip area:
<Canvas Width="200" Height="200"> <Canvas.Clip> <RectangleGeometry Rect="0,0,200,200" /> </Canvas.Clip> <Button>My button with a lot of text</Button> </Canvas>
source share