相关疑难解决方法(0)

如何让ScrollViewer在StackPanel内部工作?

在下面的WPF XAML中,ScrollViewer不起作用(它显示滚动条但不能滚动,内容从窗口向下移动到底部).

我可以将外部StackPanel更改为Grid,它将起作用.

但是,在我复制以下代码的应用程序中,我需要一个外部StackPanel.我需要对StackPanel做什么才能让ScrollViewer显示一个可用的滚动条?例如VerticalAlignment ="Stretch"Height ="Auto"不起作用.

 <StackPanel>
        <ScrollViewer>
            <StackPanel>
                <TextBlock Text="This is a test"/>
                <TextBlock Text="This is a test"/>
                <TextBlock Text="This is a test"/>
                <TextBlock Text="This is a test"/>
                <TextBlock Text="This is a test"/>
                <TextBlock Text="This is a test"/>
                <TextBlock Text="This is a test"/>
                <TextBlock Text="This is a test"/>
                <TextBlock Text="This is a test"/>
                <TextBlock Text="This is a test"/>
                <TextBlock Text="This is a test"/>
                <TextBlock Text="This is a test"/>
                <TextBlock Text="This is a test"/>
                <TextBlock Text="This is a …
Run Code Online (Sandbox Code Playgroud)

wpf xaml scrollviewer stackpanel

70
推荐指数
5
解决办法
9万
查看次数

标签 统计

scrollviewer ×1

stackpanel ×1

wpf ×1

xaml ×1