Scrollbar in Listbox not working Scrollbar in Listbox not working wpf wpf

Scrollbar in Listbox not working


I have had problems with scroll bar visibility when using a StackPanel. I think it is because the StackPanel is always as big as it needs to be to contain all of its children. Try reorganizing the layout to remove the StackPanel (use a Grid instead) and see if that helps.


You just need to introduce Height property, like this:

<ListBox Height="200"          Name="NoteList"         ScrollViewer.CanContentScroll="True"         ScrollViewer.VerticalScrollBarVisibility="Visible"></ListBox>


Heya, I suspect what might be happening is that your ListBox is expanding enough for every item however the ListBox is actually disappearing off the bottom of the Containing Control.

Does the ListBox actually stop properly or does it just seem to disappear? Try setting a MaxHeight on the ListBox and see if that makes the scrollbar appear. You should be able to set the VerticalScrollBarVisibility to Auto to have it only appear when needed.