ScrollViewer 不滚动

The ScrollViewer does not scroll(ScrollViewer 不滚动)

本文介绍了ScrollViewer 不滚动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要一个包含 3 个组件的接口,这些组件一个接一个.第一个是 ListView,另外两个是 Grid.

I would like to have an interface with 3 components one next to the other. The first would be a ListView and the two others being Grids.

由于组件会在右侧溢出,所以我想将它们放在 ScrollViewer 中.我没有成功.我试着做一个非常简单的例子来尝试,但连例子都失败了.

Since the components will overflow on the right, I want to put them in a ScrollViewer. I did not succeed. I tried to do a really simple example to try, but even the example fails.

    <ScrollViewer Grid.Column="1" Grid.Row="2" HorizontalAlignment="Left" VerticalAlignment="Top" Width="600" Height="400">
        <StackPanel Width="1200" Height="400" Orientation="Horizontal">
            <Border Background="AntiqueWhite" Width="400" Height="400" HorizontalAlignment="Left" VerticalAlignment="Top"  />
            <Border Background="Blue" Width="400" Height="400" HorizontalAlignment="Left" VerticalAlignment="Top" />
            <Border Background="LimeGreen" Width="400" Height="400" HorizontalAlignment="Left" VerticalAlignment="Top" />
        </StackPanel>
    </ScrollViewer>

如您所见,ScrollViewer 位于网格内部.我错过了什么?

As you can see, the ScrollViewer is Inside a Grid. What did I miss?

推荐答案

尝试在滚动查看器上设置这些属性:-

Try settings these properties on the scroll viewer:-

 <ScrollViewer VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Visible" ZoomMode="Disabled" Grid.Column="1" Grid.Row="2" HorizontalAlignment="Left" VerticalAlignment="Top" Width="600" Height="400">
    <StackPanel Width="1200" Height="400" Orientation="Horizontal">
        <Border Background="AntiqueWhite" Width="400" Height="400" HorizontalAlignment="Left" VerticalAlignment="Top"  />
        <Border Background="Blue" Width="400" Height="400" HorizontalAlignment="Left" VerticalAlignment="Top" />
        <Border Background="LimeGreen" Width="400" Height="400" HorizontalAlignment="Left" VerticalAlignment="Top" />
    </StackPanel>
</ScrollViewer>

这对我来说很正常!

这篇关于ScrollViewer 不滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:ScrollViewer 不滚动

基础教程推荐