question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ScrollViewer visibility bug in TextBox control

See original GitHub issue

Description

The property VerticalScrollBarVisibility of the TextBox control doesn’t work as expected. Setting such property to Visible does not reveal the vertical scrollbar. Instead, it works like setting the property to Auto. So, for example, it is not possible to mimic Notepad interface where the vertical scrollbar is visible, but disabled, when there is a short amount of text.

Steps to Reproduce

  1. Create a new WPF .Net Core app.
  2. Add a Textbox to the Grid in MainWindow.xaml and set its property VerticalScrollBarVisibility to Visible.
  3. Add the ModernWpf library to the project and then add <ui:XamlControlsResources /> in App.xaml.
  4. Run the app.

Expected Behavior

The vertical scrollbar should be shown disabled if there is a short amount of text and it will be enabled when needed.

Actual Behavior

The vertical scrollbar is hidden and doesn’t show up until needed.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
Kinnaracommented, Aug 21, 2020

Below is how the same markup looks in WinUI. For a start I’ll try to make the behavior consistent with WinUI, although it also has its own issues.

image

0reactions
XamDRcommented, Aug 14, 2020

Ok, one last try

Instead of setting the textbox’s VerticalScrollBarVisibility, try setting ScrollViewer.VerticalScrollBarVisibility attached property on the textbox.

Edit: It should work in both cases. Are values other than visible working?

ScrollViewer.VerticalScrollBarVisibility doesn’t work either. The other values work just fine. I also noticed that the same issue happens with the horizontal scrollbar.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Stop TextBox in ScrollViewer from growing with content
I have a ScrollViewer with HorizontalScrollBarVisibility set to "Auto" that contains a TextBox. The problem is that when a user enters text, ...
Read more >
TextBox.VerticalScrollBarVisibility Property
Property Value. Type: System.Windows.Controls.ScrollBarVisibility. The visibility of the vertical scroll bar. The default is Hidden.
Read more >
Implementing Scrolling in Windows using WPF ...
The Visible value makes sure the scrollbars are visible all the time regardless of the content needed scrolling or not. Let's add a...
Read more >
How to set Scrollbar in TextBox in C#? - GeeksforGeeks
Visual Studio -> File -> New -> Project -> WindowsFormApp; Step 2: Drag the TextBox control from the ToolBox and Drop it on...
Read more >
ARIA: scrollbar role - Accessibility - MDN Web Docs - Mozilla
A scrollbar is a range that controls what part of a viewport's content is currently visible in the viewport's frame; whether the viewport...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found