How can I get a vertical scrollbar in my ListBox?

后端 未结 7 1511
执念已碎
执念已碎 2020-12-13 16:55

In the example below I have a ListBox with dozens of font names in it.

I would have thought it would automatically have a vertical scrollbar on it so that you can se

相关标签:
7条回答
  • 2020-12-13 17:41

    The problem with your solution is you're putting a scrollbar around a ListBox where you probably want to put it inside the ListBox.

    If you want to force a scrollbar in your ListBox, use the ScrollBar.VerticalScrollBarVisibility attached property.

    <ListBox 
        ItemsSource="{Binding}" 
        ScrollViewer.VerticalScrollBarVisibility="Visible">
    </ListBox>
    

    Setting this value to Auto will popup the scrollbar on an as needed basis.

    0 讨论(0)
提交回复
热议问题