tags:

views:

50

answers:

1

Currently I'm using a TextBlock to show a single line with an image.

        <TextBlock>
            <Image Name="StatusImage"  Stretch="Fill" MaxWidth="12" MaxHeight="12" Source="/Aam.Cerberus.Applications;component/Images/Warning.png"></Image>
            <TextBlock Text="{Binding Path=ServiceStatusText}"></TextBlock>
            <TextBlock Text=" ("></TextBlock>
            <TextBlock Text="{Binding Path=ServiceMachineName}"></TextBlock>
            <TextBlock Text=")"></TextBlock>
        </TextBlock>

My questions are:

  1. Is a TextBlock the right way to do this sort of thing?
  2. How do I enable word wrapping?
+2  A: 

You want the TextWrapping="Wrap" property.

However, according to the MSDN

TextBlock is not optimized for scenarios that need to display more than a few lines of content; for such scenarios, a FlowDocument coupled with an appropriate viewing control is a better choice than TextBlock, in terms of performance.

ChrisF
I'm literally using nothing more than you see there. So would you still recommend a FlowDocument?
Jonathan Allen
@Jonathan - How long is the `ServiceStatusText` message? If it's only a line or two long then you should be OK with the TextBlock.
ChrisF
I think the longest phrase is "ContinuePending".
Jonathan Allen
@Jonathan - I'd stick with `TextBlock` then.
ChrisF