如何禁用水平滚动一个WPF列表框? [英] How can I disable horizontal scrolling in a WPF listbox?
本文介绍了如何禁用水平滚动一个WPF列表框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这似乎是一个太简单的问题,但谷歌和SO搜索得到什么。如何禁用水平滚动一个WPF列表框中的项目占用更多的横向空间比可用在箱子里?
This seems to be an absurdly simple question but Google and SO searches yield nothing. How can I disable horizontal scrolling in a WPF listbox when items take up more horizontal space than is available in the box?
推荐答案
在XAML:
<ListBox ScrollViewer.HorizontalScrollBarVisibility="Disabled" />
在C#:</ P>
In C#:
myListBox.SetValue(ScrollViewer.HorizontalScrollBarVisibilityProperty, ScrollBarVisibility.Disabled);
这篇关于如何禁用水平滚动一个WPF列表框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文