1

I have the following ListView:

<ListView Name="listView1" Grid.Row="1" ItemsSource="{Binding Items}" > <ListView.ItemTemplate> <DataTemplate> <StackPanel> <TextBlock Text="{Binding Title}" /> <TextBlock Text="{Binding Content}" /> <TextBlock Text="{Binding Link}" FontSize="18" /> </StackPanel> </DataTemplate> </ListView.ItemTemplate> </ListView> 

My problem is with the TextBlock cantaining the Content. If the text exceeds the width of the screen I want the remaining text to appear on the second row of the TextBlock.

Is this possible with a TextBlock ?

Thanks.

2 Answers 2

4

Just set the TextWrapping property, like so:

<TextBlock TextWrapping="Wrap"></TextBlock> 
Sign up to request clarification or add additional context in comments.

1 Comment

Oh courses, and I already try that, but instead of Content I was setting it for the Title. Thanks.
3

Use TextWrapping property

<ListView Name="listView1" Grid.Row="1" ItemsSource="{Binding Items}" > <ListView.ItemTemplate> <DataTemplate> <StackPanel> <TextBlock Text="{Binding Title}" FontSize="30" Foreground="#24FF2E" /> <TextBlock TextWrapping="Wrap" Text="{Binding Content}" FontSize="18" Foreground="#D1D8E8" /> <TextBlock Text="{Binding Link}" FontSize="18" Foreground="#009FFF"/> </StackPanel> </DataTemplate> </ListView.ItemTemplate> </ListView> 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.