TextWrapping doesn't work inside of a ScrollViewer
See original GitHub issueMCVE
xaml
<ScrollViewer>
<ItemsRepeater Items="{Binding Items}">
<ItemsRepeater.ItemTemplate>
<DataTemplate>
<Grid ColumnDefinitions="*, Auto">
<TextBlock
Grid.Column="0"
Text="{Binding Text}"
TextWrapping="Wrap" />
<TextBlock Grid.Column="1" Text="{Binding Id}" />
</Grid>
</DataTemplate>
</ItemsRepeater.ItemTemplate>
</ItemsRepeater>
</ScrollViewer>
context:
public MainWindow()
{
Items = new SomeType[]
{
new SomeType(@"Welcome to Avalonia! Avalonia is a cross platform XAML Framework for .NET Framework, .NET Core and Mono.
Avalonia is shipped as .NET standard 2.0 NuGet packages and a set of templates for Visual Studio and .NET core. We also have a visual designer for Visual Studio.
This page is designed as a whirlwind tour of Avalonia. There are plenty of links throughout to more detailed documentation on each area, or you can navigate using the sections on the left.", 0),
new SomeType(@"Avalonia lets you develop an appliction using the XAML markup language and C# (or another .NET language) for code. You generally use XAML markup to implement the appearance of an application while using code to implement its behavior.", 1),
new SomeType(@"XAML is an XML-based markup language that implements an application's appearance declaratively. You typically use it to create windows and user controls, and to fill them with controls, shapes, and graphics.
The following example uses XAML to implement the appearance of a window that contains a single button", 2)
};
AvaloniaXamlLoader.Load(this);
DataContext = this;
}
public IEnumerable<SomeType> Items { get; }
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
ScrollViewer and TextBlock wrapping - wpf
How can I achieve this in xaml? It seems that as soon as ScrollViewer is inserted, TextBlock does not wrap any more. wpf...
Read more >How to get WPF ScrollViewer to automaticall scroll ...
In XAML I have a WPF TextBlock inside of a ScrollViewer. I would like the ScrollViewer to automatically scroll the TextBlock contents so ......
Read more >ScrollViewer Overview - WPF .NET Framework
The ScrollViewer control provides a convenient way to enable scrolling of content in Windows Presentation Foundation (WPF) applications.
Read more >Scrolling entire elements problem in UI for WPF
Hello, Indeed the explained behavior is caused by the different Heights of the ListBoxItems - a single item is always scrolled to top...
Read more >Implementing Scrolling in Windows using WPF ...
The simplest way to enable scrolling on a content control is by placing the content control inside a ScrollViewer control. The following code ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks. Works fine with
If it is not disabled the content is measured with infinite space. That prevents text wrapping. It is worth a try to disable horizontal scrolling.