ScrollViewer not scrolling in WPF

后端 未结 5 647
滥情空心
滥情空心 2020-12-09 01:45

I am using a scrollviewer control around my stack panel which contains an ItemsControl. When there are many items in the ItemsControl it is suppose to scroll but for some re

5条回答
  •  甜味超标
    2020-12-09 02:04

    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.

提交回复
热议问题