ScrollViewer not scrolling in WPF?

Try a grid around your ScrollViwer instead of the StackPanel. I think StackPanel will provide as much height as the internal content wants, so here the Scrollviwer doesn't work properly since its height is not get restricted by its parent control.

Try a grid around your ScrollViwer instead of the StackPanel. I think StackPanel will provide as much height as the internal content wants, so here the Scrollviwer doesn't work properly since its height is not get restricted by its parent control. You can understand the issue from the example below.

Above code is similar to yours and it doesn't give you scrollbars. But see the below code in which I changed only the StackPanel to a Grid(Any panel which respects the size of its children based on panels size but stackpanel doesnt) UPDATE : But if you really need to use StackPanel then you might need to set the size for your ScrollViwer to get the Content scroll.

This might not be possible since everything is inside the StackPanel. There is NO grid on the page. Only master stackpanel which contains two other stackpanels.

This even happens when I say height of stackpanel to be like 100. – azamsharp Jul 15 '09 at 18:19 The problem is that every control on the Window is contained in a master stack panel control. – azamsharp Jul 15 '09 at 18:21 1 But if you really need to use StackPanel then you might need to set the size for your ScrollViwer to get the Content scroll, because as I said earlier a StackPanel doesn't respect its children's height or width.So we have to set a height and width when we use StackPanel – Jobi Joy Jul 15 '09 at 18:29 I set the height on the ScrollViewer and it worked!

Thanks a lot! – azamsharp Jul 15 '09 at 18:38 1 Check my answer: it solves the problem binding to the actualHeight of the StackPanel – Eduardo Molteni Jul 15 '09 at 18:51.

You must fix the Height of the Scrollviewer, but can easily bind to the StackPanel ActualHeight: (tested code) Or better yet, if you can't change the name of the StackPanel: It is a "You first" problem, the StackPanel ask the ScrollViewer for the Height and the ScrollViewer ask the StackPanel for the max Height it can be.

2 Thanks for such informative answer! This will definitely come in handy! – azamsharp Jul 15 '09 at 18:58.

The ItemsControl should contain the ScrollViewer, not the other way around. All that the ScrollViewer knows about is the ItemsControl itself in your case - it doesn't know about the inner items. Try something like this.

It is not necessary to have a scrollviwer, the problem in the question is the StackPanel. – Jobi Joy Jul 15 '09 at 18:16 You need a ScrollViewer somewhere, though, since by default ItemsControl doesn't scroll. I've used this code and it works, although your answer would probably work as well.

– Andy Jul 15 '09 at 18:18 Yeah your code also works only if he removes the outer StackPanel and it doesn't matter you have a scrollbar inside the ControlTemplate or outside of the ItemsControl both are almost same. – Jobi Joy Jul 15 '09 at 18:22.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions