How can I disable horizontal scrolling in a WPF ListBox?

前端 未结 2 679
死守一世寂寞
死守一世寂寞 2020-12-13 05:10

This seems to be an absurdly simple question but Google and Stack Overflow searches yield nothing. How can I disable horizontal scrolling in a WPF ListBox when items take up

2条回答
  •  Happy的楠姐
    2020-12-13 05:59

    In XAML:

    
    

    In C#:

    myListBox.SetValue(
        ScrollViewer.HorizontalScrollBarVisibilityProperty,
        ScrollBarVisibility.Disabled);
    

提交回复
热议问题