Select to view content in your preferred language

Text Wrap in TextBlock

1117
2
04-15-2011 07:43 AM
JayKappy
Frequent Contributor
I have a map tip set up on a Feature Layer.
One of the fields is too long...what I am trying to do is wrap the text...and failing...

I first figured it would expand the MapTip dialog box but then nothing was wrapping...so I set the width adn height and still no wrapping...

Thoughts?


I tried this
        <esri:FeatureLayer.MapTip >
                                    <Border esri:GraphicsLayer.MapTipHideDelay="00:00:01.5" CornerRadius="10" 
                                         BorderBrush="#FF222957" BorderThickness="3" Margin="0,0,15,15">
                                        <Border.Background>
                                            <LinearGradientBrush EndPoint="1.038,1.136" StartPoint="0.015,0.188">
                                                <GradientStop Color="#FFD1DFF2"/>
                                                <GradientStop Color="#FF092959" Offset="0.946"/>
                                            </LinearGradientBrush>
                                        </Border.Background>
                                        <Border.Effect>
                                            <DropShadowEffect ShadowDepth="10" BlurRadius="14" Direction="300" />
                                        </Border.Effect>
                                        <Grid>
                                            <StackPanel Orientation="Vertical" Margin="5" Height="150" Width="250" VerticalAlignment="Center">
                                                 <StackPanel Orientation="Horizontal">
                                                    <TextBlock Text="Location:      " FontWeight="Bold" HorizontalAlignment="Left" VerticalAlignment="Center" />
                                                    <TextBlock TextWrapping="Wrap" Text="{Binding Converter={StaticResource MyDictionaryConverter},
                                                                ConverterParameter=Location, Mode=OneWay}" />
                                                </StackPanel>
                                            </StackPanel>
                                            <Border BorderBrush="Black" BorderThickness="1" />
                                        </Grid>
                                        </Border>
                                </esri:FeatureLayer.MapTip>
0 Kudos
2 Replies
JayKappy
Frequent Contributor
Got it...just set a width adn it brought it back in and did the wrap

<TextBlock TextWrapping="Wrap" Width="150" Text="{Binding Converter={StaticResource MyDictionaryConverter}, ConverterParameter=Location, Mode=OneWay}" />
0 Kudos
ChristopherHill
Deactivated User
The problem you are seeing is a common when working with StackPanel.

Orientation="Horizontal"
any items that do not fit horizontal(width) will overflow through the side of the stack panel.

Orientation="Vertical"
any items that do not fit vertically(height) will overflow through the bottom of the stack panel.


So as soon as your items reach the fixed width they will just clip under the side of the stack panel.

<StackPanel Orientation="Vertical" Margin="5" Height="150" Width="250" VerticalAlignment="Center">
                                                 <StackPanel Orientation="Horizontal">
                                                    <TextBlock Text="Location:      " FontWeight="Bold" HorizontalAlignment="Left" VerticalAlignment="Center" />
                                                    <TextBlock TextWrapping="Wrap" Text="{Binding Converter={StaticResource MyDictionaryConverter},
                                                                ConverterParameter=Location, Mode=OneWay}" />
                                                </StackPanel>
                                            </StackPanel>



If the combine width of your two textblock exceeds 250 then you will see text cliping.
0 Kudos