I have a text box with verticalscrollbarvisibility set to auto. I would like to do a test to find out if the scrollbar is actually visible during runtime. I have tried the statement:
if (textbox1.VerticalScrollBarVisibility == ScrollBarVisibility.Visible)
but it does not work. Any ideas?
First place the following extension method in static class (either place the class in the same namespace as the rest of your code or in namespace included with a
usingstatement in your code file):-With this extension method available you can dig out the ScrollViewer inside the text box which is responsible for the scroll bar and test its
ComputedVerticalScrollBarVisibility.