In my program, I have a TextBlock where my result text is shown. In a textbox I can just use TextWrapping="Wrap"
and I can scroll down if it's still too much for the textbox. Now in my TextBlock that I talked about I wanted to have the same thing and used TextWrapping="Wrap"
again. That works except for the scrolling thing. What can I do now to let it scroll like in the textbox?
CodePudding user response:
Use following structure
<ScrollViewer HorizontalScrollBarVisibility="Auto" x:Name="scrView" VerticalScrollBarVisibility="Auto" Width="100" Height="100">
<TextBlock Width="{Binding Path=ActualWidth, ElementName=scrView}" TextWrapping="Wrap">your text</TextBlock>
</ScrollViewer>