Tugrul Emre Atalay
Tugrul Emre Atalay

Reputation: 938

TextBlock is Cutting Text in Windows Phone

In my WP8 project textblock is cutting text unexpectedly. How can I solve it? I have used VerticalAlignment Strecth or Height auto in scrollviewer but they have not solve it.

Textblock

And my xaml, I am using one of these stackpanels :

 <ScrollViewer>
                    <Grid>
                        <StackPanel x:Name="stackNormal" Visibility="Collapsed" VerticalAlignment="Top" Background="Transparent">
                            <ListBox Name="ImageList"  ItemsSource="{Binding Summary.Text , Converter={StaticResource ImageFromRssText}}" ScrollViewer.VerticalScrollBarVisibility="Disabled">
                                <ListBox.ItemTemplate>
                                    <DataTemplate>
                                        <Image Source="{Binding URL}" Tag="{Binding Title}" Margin="5,15,0,0"></Image>
                                    </DataTemplate>
                                </ListBox.ItemTemplate>
                            </ListBox>
                            <TextBlock TextDecorations="Underline" MouseLeftButtonUp="feedTitle_MouseLeftButtonUp" FontSize="25" Name="feedTitle" TextWrapping="Wrap"  HorizontalAlignment="Stretch" Foreground="{StaticResource PhoneAccentBrush}" Text="{Binding Title.Text, Converter={StaticResource RssTextTrimmer}}" VerticalAlignment="Top" Margin="5,3,0,2" />
                            <TextBlock Name="feedSummary" TextWrapping="Wrap" Margin="5,0,15,0" Text="{Binding Summary.Text, Converter={StaticResource RssTextTrimmerLong}}" HorizontalAlignment="Stretch" FontSize="20" VerticalAlignment="Stretch"/>
                            <TextBlock Name="feedPubDate" Foreground="{StaticResource PhoneSubtleBrush}" Margin="12,20,0,5" Text="{Binding PublishDate.DateTime}" HorizontalAlignment="Center" />
                        </StackPanel>
                        <StackPanel x:Name="stackPhotoBug" Visibility="Collapsed" VerticalAlignment="Top" Background="Transparent">
                            <ListBox Name="ImageList2"  ItemsSource="{Binding Links}" ScrollViewer.VerticalScrollBarVisibility="Disabled">
                                <ListBox.ItemTemplate>
                                    <DataTemplate>
                                        <Image Source="{Binding Converter={StaticResource ImagesFromRssTextForPhotoBug}}" HorizontalAlignment="Stretch" Margin="5,15,0,0" MaxHeight="500"></Image>
                                    </DataTemplate>
                                </ListBox.ItemTemplate>
                            </ListBox>
                            <TextBlock TextDecorations="Underline" MouseLeftButtonUp="feedTitle_MouseLeftButtonUp" FontSize="25" Name="feedTitle2" TextWrapping="Wrap"  HorizontalAlignment="Stretch" Foreground="{StaticResource PhoneAccentBrush}" Text="{Binding Title.Text, Converter={StaticResource RssTextTrimmer}}" VerticalAlignment="Top" Margin="5,3,0,2" />
                            <TextBlock Name="feedSummary2" TextWrapping="Wrap" Margin="5,0,15,0" Text="{Binding Summary.Text, Converter={StaticResource RssTextTrimmerLong}}" HorizontalAlignment="Stretch" FontSize="20" VerticalAlignment="Stretch"/>
                            <TextBlock Name="feedPubDate2" Foreground="{StaticResource PhoneSubtleBrush}" Margin="12,20,0,5" Text="{Binding PublishDate.DateTime}" HorizontalAlignment="Center" />
                        </StackPanel>
                    </Grid>
                </ScrollViewer>

Upvotes: 0

Views: 642

Answers (3)

Amit Bhatiya
Amit Bhatiya

Reputation: 2621

Any element that must be displayed beyond the area which is larger than 2048x2048 pixels would be clipped by the platform

Creating Scrollable TextBlock for WP7.

Upvotes: 1

Nikita
Nikita

Reputation: 154

Maybe it is because of such big text (TextBlock has limit - 2048px). You should try ScrollableTextBlock

Upvotes: 2

Rev
Rev

Reputation: 33

Place the textblock inside scrollviewer

<scrollviewer verticalBarvisibility="visible">
    <TextBlock Name="feedSummary" TextWrapping="Wrap"
               Text="{Binding Summary.Text, Converter={StaticResource RssTextTrimmerLong}}" 
               HorizontalAlignment="Stretch" FontSize="20"
               VerticalAlignment="Stretch"/>
</scrollviewer>

Upvotes: 1

Related Questions