WPF: ListBox with WrapPanel, vertical scrolling problem

前端 未结 5 2286
孤街浪徒
孤街浪徒 2020-12-15 17:24

I have a UserControl (XAML below) that has a ListBox that I want to display images inside a WrapPanel, where images are displayed as many as will fit on one row and then wra

5条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-15 17:53

    Well, I finally stumbled upon the solution. I was adding my UserControl to a placeholder panel that looked like this:

                
                    
                
    

    However, when I switched it to a Grid instead, things started to work the way I wanted:

    
    

    I think it has to do with the StackPanel not taking up all the vertical space by default, like the Grid is doing.

提交回复
热议问题