I have a ListView and in it's ItemTemplate there's a TextBlock (inside a Grid) which often has long lines of text. The problem is if the text is too long it increases the width of the ListViewItem rather than wrapping the text. How can I limit the width of the TextBlock so that it will not exceed the width of the ListView?
I don't want to hardocde the width to a constant value.
I tried setting the ScrollViewer.HorizontalScrollBarVisibility property to Disabled and setting TextWrapping="Wrap" on the TextBlock, but that didn't do the trick. When I debug the application the Live Property Explorer shows that even though the ScrollViewer.HorizontalScrollBarVisibility is disabled it's still horizontally scrollable (the IScrollProvider.HorizontallyScrollable property is true).
Any idea how I can limit the textblock size properly?
MaxWidth
property ofTextBlock
? – AarónBC.