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" />

Share:

Leave A Reply

Your email address will not be published. Required fields are marked *

You May Also Like

In this post, you’ll learn about the error message “FileOpenAccessDenied – You do not have permissions to open this file...
  • .NET
  • December 3, 2024
You might have had a situation where your code once worked fine in ASP.NET application but now throws the below...
  • .NET
  • December 3, 2024
C# uses the flower bracket “{” and “}” to identify the block or scope of the function or program ....
  • .NET
  • December 3, 2024