开发者

long text cropped in textblock

开发者 https://www.devze.com 2023-02-07 04:24 出处:网络
I\'ve a problem. I\'ve a textblock and my text is cropped. It seems to appear only when the text is too long cause when the text is shorter, there is no problem.

I've a problem. I've a textblock and my text is cropped. It seems to appear only when the text is too long cause when the text is shorter, there is no problem.

So开发者_如何学编程 there is my code :

<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
    <Grid.RowDefinitions>
        <RowDefinition Height="150" />
        <RowDefinition Height="447*" />
    </Grid.RowDefinitions>
        <Image Grid.Row="0" Source="{Binding TheContent.PathPicture}" />
        <ScrollViewer Grid.Row="1">
            <Grid>
                <TextBlock Text="{Binding TheContent.Text}" TextWrapping="Wrap" FontSize="24" />
            </Grid>
        </ScrollViewer>
</Grid>

Text is croping like this :

long text cropped in textblock

Is the only solution to summary my content ?


The depth of a single textblock is limited to about 2000 pixels on WP7. You need to divide up your text into multiple blocks to display it all.


Controls are limited to 2k square, but there's a fairly straight forward resolution in breaking your text up and presenting the blocks in a stackpanel and wrapping that in a ScrollViewer.

Alex Yakhnin demonstrates here.

Creating Scrollable TextBlock for WP7.

0

精彩评论

暂无评论...
验证码 换一张
取 消