请告诉我如何隐藏滚动条,使其不在 Silverlight 中显示。 我不想要垂直或水平滚动条。我想隐藏两者。请帮忙
最佳答案
您可以将 ScrollViewer.HorizontalScrollBarVisibility 和/或 ScrollViewer.VerticalScrollBarVisibility 附加属性设置为“禁用”。例如,如果您有以下 XAML:
<ListBox Height="100" Name="listBox1" Width="100">
<ListBoxItem>
<Rectangle Width="200" Height="50" Fill="#FF894220" />
</ListBoxItem>
<ListBoxItem>
<Rectangle Width="200" Height="50" Fill="#FFB94222" />
</ListBoxItem>
</ListBox>
因此你会得到滚动条,像这样:
[不幸的是,在我获得更高的声誉(我正在努力建立)之前,StackOverflow 不允许我发布图像。你必须想象它或自己尝试]
将 ScrollViewer 附加属性添加到 ListBox 元素:
<ListBox Height="100" Name="listBox1" Width="100"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
ScrollViewer.VerticalScrollBarVisibility="Disabled">
<ListBoxItem>
<Rectangle Width="200" Height="50" Fill="#FF894220" />
</ListBoxItem>
<ListBoxItem>
<Rectangle Width="200" Height="50" Fill="#FFB94222" />
</ListBoxItem>
</ListBox>
导致没有滚动条。
希望这有助于...
克里斯
关于silverlight-4.0 - 在 Silverlight 中隐藏列表框的滚动条,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3794546/