How to Show Automatic Vertical Scroll bar in WPF TextBlock?

There are times where you want to show automatic scroll bar in a WPF TextBlock and you can easily achieve it by wrapping the TextBlock in a scroll viewer.

How to Show Automatic Vertical Scroll bar in WPF TextBlock?

<ScrollViewer>
    <TextBlock />
</ScrollViewer>

How to Show Automatic Vertical Scroll bar in WPF TextBox?

If you have a TextBox and wish to scroll bars in a TextBox , then you can use the ScrollViewer attached properties as shown below.

<TextBox ScrollViewer.HorizontalScrollBarVisibility="Disabled"
         ScrollViewer.VerticalScrollBarVisibility="Auto" />
Copy link
Powered by Social Snap