LineStackingStrategy in Silverlight 3

17 Oct

LineStackingStrategy is one of the properties you can set on a TextBlock in Silverlight that enables you to get better control over how text is displayed.

LineStackingStrategy has two valid values: BlockLineHeight and MaxHeight. BlockLineHeight uses the LineHeight defined at the TextBlock even if the elements in the TextBlock actually requires more space. MaxHeight will compensate for this and will use the smallest lineheight required by all elements in the TextBlock.

Lets take a look at an example:

        FontSize="12">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
        incididunt ut labore et dolore magna aliqua.</Run>
        Foreground="Red">Ut enim ad minim veniam, quis nostrud exercitation
        ullamco laboris nisi ut aliquip ex ea commodo consequat.</Run>
        FontSize="12">Duis aute irure dolor in reprehenderit
        in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat
        non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</Run>

If we use BlockLineHeight:


If we use Maxheight:


by xamlgeek

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: