How to make scrollviewer work with Height set to Auto in WPF?

前端 未结 5 1596
轻奢々
轻奢々 2020-12-05 11:28

I have learned that if the height of a grid row, where the ScrollViewer resides, is set as Auto, the vertical scroll bar will not take effect since

5条回答
  •  情书的邮戳
    2020-12-05 12:05

    You can either set a fix height on your ScrollViewer but then you have to consider that the second row of your grid will have that height too since row's first child will be the ScrollViewer and row's height is auto, or you bind the height of ScrollViewer to another control in your layout. We don't know how your layout looks alike.

    At the end if you don't like neither of both just set the row's height to * as swiszcz suggested or hack wpf write your own custom panel that will be able to layout everything possible in every parallel universe or something like that. :)

提交回复
热议问题