如果控件大小小于列表框大小,则无法禁用垂直滚动查看器

时间:2014-07-22 12:06:19

标签: c# wpf xaml listbox scrollviewer

当我的控件的大小小于listbox时,verticalscrollviewer会自动启用。

<ListBox Name="listBox" ItemsSource="{Binding DropPlaces}"
                 ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Disabled">
    <ListBox.ItemsPanel>
        <ItemsPanelTemplate>
            <WrapPanel FlowDirection="LeftToRight" Orientation="Horizontal" />
        </ItemsPanelTemplate>
    </ListBox.ItemsPanel>
    <ListBox.ItemTemplate>
        ...
    </ListBox.ItemTemplate>
</ListBox>

2 个答案:

答案 0 :(得分:0)

答案 1 :(得分:0)

尝试设置两个值:

VerticalContentAlignment="Stretch"
ScrollViewer.VerticalScrollBarVisibility="Disabled"