SL2B1 TextBlock wrapping bug? Any work-arounds?
Last post 05-12-2008 10:55 PM by Alan Cobb. 4 replies.
Sort Posts:
05-10-2008 6:01 PM
SL2B1 TextBlock wrapping bug? Any work-arounds?

Hi,

Under some conditions TextBlock's text wrapping in SL2B1 makes text completely disappear from the TextBlock.  My simple demo app reproduces the problem 100% of the time.

The demo app, problem description and source code are here:
http://www.alancobb.com/pub/SL2/SL2B1_Bugs/TextBlockWrapping/ProblemDescription.htm

Addendum:
The problem seems to result when a TextBlock wraps at a point between two Runs.
A work-around is to only have one Run per TextBlock.  The disadvantage is you can
only use one text style (properties of Run) per TextBlock.

Is this a known issue?  Any suggested work-arounds?

Thanks,
Alan Cobb
www.alancobb.com/blog (Silverlight blog)

Alan Cobb

Joined on 04-30-2007
Northern California, USA
Posts 111
05-12-2008 11:49 AM
Re: SL2B1 TextBlock wrapping bug? Any work-arounds?

Alan,

I have also run into some strange TextBlock wrapping issues when I have TextBlocks inside of a StackPanel.  It seems that for some wide TextBlocks, the TextBlock wraps around to the next row...even when an explicit width is set along with NoWrap.  I was able to work around the issue by switching the container control from a StackPanel to a Grid.  I don't know if this helps you out any, but I thought I would mention my issue as well.  

If this has answered your question, please click on "Mark as Answer" on this post.

Thanks,
Page Brooks, MCSD, MCAD
PageBrooks.com | RSS Feed

pbrooks

Joined on 03-23-2006
Florence, SC
Posts 116
05-12-2008 12:27 PM
Re: SL2B1 TextBlock wrapping bug? Any work-arounds?

Hi Page,

Interesting.  Unfortunately, adding a StackPanel or Grid around my
TextBlock does not help my particular wrapping issue.

I reduced my repro-demo to the following XAML.  As you resize 
the browser window horizontally, when wrapping has to take place 
between the two Runs "... a a a" and "b", all the text "disappears" from
the TextBlock.

<UserControl
    x:Class="SL2B1_TextBlockWrapIssue.Page"
    xmlns="http://schemas.microsoft.com/client/2007"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <TextBlock  TextWrapping="Wrap">
        <Run>a a a a a a a a a a a a a a a a a a a a a a</Run>
        <Run>b</Run>
    </TextBlock>

</UserControl>

Alan Cobb
www.alancobb.com/blog (Silverlight blog)

Alan Cobb

Joined on 04-30-2007
Northern California, USA
Posts 111
05-12-2008 10:47 PM
Marked as Answer
Re: SL2B1 TextBlock wrapping bug? Any work-arounds?

Hi:

  This issue has been fixed in the latest bits.

Thanks for your reporting.

Sincerely,
Allen Chen
Microsoft Online Community Support

Please remember to mark the replies as answers if they help and unmark them if they provide no help.

Allen Chen – MSFT

Joined on 03-16-2007
Posts 717
05-12-2008 10:55 PM
Re: SL2B1 TextBlock wrapping bug? Any work-arounds?

Great.  Thanks Allen.

Alan Cobb

Alan Cobb

Joined on 04-30-2007
Northern California, USA
Posts 111