Silverlight 4 Rough Notes: TextBlock with Trimming

Note – these posts are put together after a short time with Silverlight 4 as a way of providing pointers to some of the new features that Silverlight 4 has to offer. I’m posting these from the PDC as Silverlight 4 is announced for the first time so please bear that in mind when working through these posts.

A simple new feature in Silverlight 4 – if you have a TextBlock where the text overflows the space available then you can set the TextTrimming property;

    <TextBlock
            Text="The quick brown fox jumps over the lazy dog"
            TextTrimming="WordEllipsis" />

with the effect that as I resize the browser window ( in this case );

image

it displays the familiar “…” to indicate that there’s more text that is revealed if I give the text more space.