Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/268.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如果控件大小小于列表框大小,则无法禁用垂直滚动查看器_C#_Wpf_Xaml_Listbox_Scrollviewer - Fatal编程技术网

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

C# 如果控件大小小于列表框大小,则无法禁用垂直滚动查看器,c#,wpf,xaml,listbox,scrollviewer,C#,Wpf,Xaml,Listbox,Scrollviewer,当我的控件的大小小于listbox时,verticalscrollviewer将自动启用 <ListBox Name="listBox" ItemsSource="{Binding DropPlaces}" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Disabled"> <ListBox.

当我的控件的大小小于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>
尝试将ScrollViewer.VerticalScrollBarVisibility设置为自动

尝试设置两个值:

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

你说的是哪个控件?同时发布控件的代码。HorizontalScrollBarVisibility=Hiddenofc不起作用。我需要禁用垂直滚动条。然后将其设置为禁用。