Click here to Skip to main content
15,500,453 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have created a wpf usercontrol and i have a scrolviewer where i have added the vertical scroll bar as Auto. The Scroll bar is creating but not allowing to scroll that. Below is the code.

What I have tried:


<ScrollViewer  x:Name="viewer" CanHorizontallyScroll="True" HorizontalAlignment="Left" Height="296" Margin="10,71,0,0" VerticalAlignment="Top" Width="186" Grid.RowSpan="2" VerticalScrollBarVisibility="Auto">

            <StackPanel x:Name="stackPanel" Orientation="Vertical" Width="186">


Textblock are added dynamically to the stackpanel via Code. The problem is data getting displayed but the vertical scroll bar is not allowing to scroll as it is disabled.
Gerry Schmitz 8-Jun-21 13:50pm    
You should be "flowing" text (blocks) instead of attempting both horizontal and vertical scrolling on a vertical StackPanel.
Rocky_Bas 8-Jun-21 14:05pm    
Did get your point can you be more specific
Gerry Schmitz 9-Jun-21 0:06am    
Set horizontal scroll on the viewer to false, and use multi-line textboxes with wrapping in the stackpanel; with the StackPanel in a "*" width Grid column.
Rocky_Bas 9-Jun-21 1:51am    
Just found the issue thing is the Stackpanel inside the scrollViewer is Disabled/Read only mode due to which i am not able to click on textbox and scroll bar any idea how to fix that

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900