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 4.8 shows what this XAML looks like in the Visual Studio designer:

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

Get Universal Windows® Apps with XAML and C# Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.