3

So I have this problem, a textblock's text gets cut off, even though you can still scroll with scrollviewer to the end.

Text gets sort of "cut off" You can see the scrollviewer is still able to scroll to where the text should be.

Heres the XAML:

<Grid>
    <ScrollViewer Height="Auto" VerticalScrollBarVisibility="Auto" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch" >
        <TextBlock x:Name="text" Padding="5" Margin="0" TextWrapping="Wrap" Text="" FontSize="24" TextTrimming="WordEllipsis" VerticalAlignment="Bottom" />
    </ScrollViewer>
</Grid>

EDIT the whole pivot control code:

<controls:Pivot x:Name="pivot" Margin="0" Grid.Row="1" Title="title" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch">
        <controls:PivotItem Header="Straipsnis">
            <Grid>
                <ScrollViewer Height="Auto" VerticalScrollBarVisibility="Auto" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch" >
                    <Border BorderBrush="White" BorderThickness="1">
                        <TextBlock x:Name="text" Padding="5" TextWrapping="Wrap" Text="" FontSize="24"/>
                    </Border>
                </ScrollViewer>
            </Grid>
        </controls:PivotItem>
        <controls:PivotItem Header="Komentarai">
            <Grid>
                <ListBox x:Name="commentsListBox" ItemTemplate="{StaticResource CommentsList}" Height="Auto" Width="Auto" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch" HorizontalAlignment="Stretch" FontSize="20"/>
                <TextBlock x:Name="errorText" TextWrapping="Wrap" Text="Nėra komentarų..." FontSize="36" HorizontalAlignment="Left" Margin="10,0,0,0"/>
            </Grid>
        </controls:PivotItem>
    </controls:Pivot>
Domas
  • 139
  • 3
  • 9
  • have u tried margin in TextBlock? – D J May 23 '13 at 10:21
  • I think you have to define a MaxHeight or MaxWidth – sexta13 May 23 '13 at 10:57
  • I would say that the problem is on the size of the control that contains the Grid. Could you post the code of the full page, or at least the PivotItem? – anderZubi May 23 '13 at 13:05
  • Did that. Really weird problem, I think pretty much every alignment property is set to stretch :/ Tried the same with TextBox instead of TextBlock - the same result – Domas May 23 '13 at 13:26
  • Check this out: http://stackoverflow.com/questions/1981137/c-sharp-wpf-scrollviewer-textblock-troubles – morincer May 23 '13 at 13:40

1 Answers1

1

Well, turns out the TextBlock has limits, 2048x2048 or something like that, after which the text just gets cut off. So, I found this custom text control that bypasses this limitation :) Maybe someone will find it useful, I did.

Creating Scrollable TextBlock for WP7.

Download link

Community
  • 1
  • 1
Domas
  • 139
  • 3
  • 9