PHP Java Eng
PHP Java Eng

Reputation: 91

Binding Text on TextBlock not show the whole text windows phone 8

I've got an issue that the TextBlock not showing fully while the string is more than 1000 characters.

I've tried use this code

ScrollViewer.HorizontalScrollBarVisibility="Disabled"

or

VerticalAlignment="Stretch" on my TextBlock

or use this code

<ListBox ItemsSource="{Binding ArticleDataDetail}" ScrollViewer.VerticalScrollBarVisibility="Visible">
<ListBox.ItemTemplate>
    <DataTemplate>

        <StackPanel Orientation="Vertical">
            <TextBlock Text="{Binding TaxoName}" Style="{StaticResource PhoneTextNormalStyle}" Foreground="#FF2976B9"/>
            <TextBlock Text="{Binding Title}" FontWeight="Bold" TextWrapping="Wrap" Style="{StaticResource PhoneTextTitle3Style}"/>
            <Image Source="{Binding Picture}" Width="auto" Name="articleImage" Margin="10"/>
            <TextBlock Text="{Binding Content}" TextWrapping="Wrap"></TextBlock>
         </StackPanel>

    </DataTemplate>
</ListBox.ItemTemplate>
</ListBox>

But It still not show.

my code:

<Grid Margin="12,0,12,0" DataContext="{Binding ArticleDataDetail[0]}">
    <ScrollViewer HorizontalScrollBarVisibility="Disabled">
        <StackPanel>
            <TextBlock Text="{Binding Content}" TextWrapping="Wrap" VerticalAlignment="Stretch"></TextBlock>
            <TextBlock Text="GeuT"></TextBlock>
        </StackPanel>
    </ScrollViewer>
</Grid>

Upvotes: 0

Views: 655

Answers (2)

Kristina
Kristina

Reputation: 91

Another thing I could think of - without a screenshot - is that maybe the Textblock is too small to fit all the content and that it would have to be scrollable.

Scrollbars don't appear automatically if the text exceeds the display item size limits. You can enable them by adding the following properties to your TextBlocks:

ScrollViewer.VerticalScrollMode="Auto" ScrollViewer.VerticalScrollBarVisibility="Visible"

Upvotes: 0

user5109611
user5109611

Reputation:

Do you mean the TextBlock in the ItemTemplate? If it's the case maybe this helps:

Set the HorizontalContentAlignment attribute of the ListBox to "Stretch":

<ListBox ... HorizontalContentAlignment="Stretch"></ListBox>

I'm just guessing what your problem is, so if it's not the case I think you should make your question clearer: rephrase it or add some illustrating images.

Upvotes: 1

Related Questions