O'Reilly logo

XAML Unleashed by Adam Nathan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Clipping

Clipping (that is, truncating or cropping) children is the default way that panels handle them when they are too large. Clipping can happen at the edges of a panel or within a panel (such as at the edges of a Grid cell). This behavior can be controlled to some degree, however.

The following 2x2 Grid contains two TextBlocks. The top one gets clipped by the right edge of its cell, but the bottom one does not. That’s because a Canvas ignores any size constraints that its parent tries to impose. Furthermore, a Canvas, unlike other panels, never clips its children. Figure 6.13 shows what this XAML looks like in the Visual Studio designer:

<Page ...>  <Grid Width="200" Height="200"        Background="{StaticResource ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required