Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/12.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# 用于扩展器内列表框的垂直滚动条-WPF_C#_Wpf_Listbox - Fatal编程技术网

C# 用于扩展器内列表框的垂直滚动条-WPF

C# 用于扩展器内列表框的垂直滚动条-WPF,c#,wpf,listbox,C#,Wpf,Listbox,我正在开发WPF应用程序。我在扩展器中有一个列表框,我想做的是让列表框有一个垂直滚动条。这是我的密码: <Expander Grid.Row="1" Header="More Details" > <ListBox ScrollViewer.VerticalScrollBarVisibility="Visible" Height="20" ItemsSource="{Binding Path=DetailsItems

我正在开发WPF应用程序。我在扩展器中有一个列表框,我想做的是让列表框有一个垂直滚动条。这是我的密码:

<Expander Grid.Row="1" Header="More Details" >
    <ListBox ScrollViewer.VerticalScrollBarVisibility="Visible" 
             Height="20"
             ItemsSource="{Binding Path=DetailsItemsSource, Mode=TwoWay}" 
             ItemTemplate="{Binding Path=DetailsTemplate, Mode=TwoWay}">
    </ListBox>
</Expander>


我可以在列表框中看到一个滚动条区域,但没有滚动条本身(即使有看不见的项目)。谢谢

更改布局以移除扩展器并使用网格,看看这是否有帮助。另一个解决方案是 您需要设置ScrollViewer的Height属性。类似于

<Expander Header="expander1" Width="150" HorizontalAlignment="Left">
                <ScrollViewer Height="75">
                    <ListBox>

                    </ListBox>
                </ScrollViewer>
</Expander>

我可以知道您为什么使用扩展器吗?